Вопрос

I have been using Rails Admin in my Rails application for a while now. Recently, we decided to separate our API from our Web Application and we decided to have our models (that are shared between the two) in a Gem.

Now, Rails Admin, which somehow scans the models in my app, have stopped showing me these models in the admin panel (even though they are accessible from the application).

Any idea on how to fix it?

My gem directory structure is:

name1-name2(main directory)  
      lib(directory)  
          name1(directory)  
               name2(directory)     
                 mymodel.rb  
                 name2.rb (which requires all other models)  
gemspec
Это было полезно?

Решение

Use config.included_models which whitelists models, both healthier and will let you include gem models:

config.included_models = ['User', 'YourNameSpace::ModelName']

Другие советы

Try making a local version of the model that inherits from the shared version in the gem. Rails admin might be looking only at models local to your app.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top