문제

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