updating rails_admin broke config.included_models?

104 views
Skip to first unread message

shawndrost

unread,
Aug 13, 2011, 7:48:11 PM8/13/11
to rails_admin
Updating from the rails-3.0 branch recently seems to have broken my
list of included models. A random selection of my app's models are
now appearing in the menu. Can't find anything in the docs about
changes to this part of the config. Anyone know of a recent change
that would cause this?

Gady

unread,
Aug 15, 2011, 9:56:51 AM8/15/11
to rails_admin
I'm in a similar situation.
I specified
config.included_models = ["Model1", "Model2", "Model3"]
config.excluded_models << "Model4"
but I still get random models missing in development, and constantly
in production (heroku)
In development the missing models appears when refreshing the page.

I tried debugging in development and ispected
RailsAdmin.config(Model1).visible?
In the first request it was false and the second true

Any advice ?

Thanks
Gady

Gady

unread,
Aug 15, 2011, 10:12:14 AM8/15/11
to rails_admin
It seems that adding the following code to the models solves the
symptom

rails_admin do
visible { true }
end

Gady

unread,
Aug 15, 2011, 10:24:09 AM8/15/11
to rails_admin
But now I get an error when clicking the model

shawndrost

unread,
Aug 16, 2011, 5:08:09 PM8/16/11
to rails_admin
Gady (and others) -- I'm pretty sure this is related to the
deprecation of the system to do configuration with
ActiveRecord::Base#rails_admin. Personally, I'm going to see if I
still need that -- iirc, there was a bug preventing me from using the
initializer.

Gady

unread,
Aug 17, 2011, 10:53:52 AM8/17/11
to rails_admin
Where can I read more about the deprecation ?
the readme still instructs to use that method.
what is the alternative?

shawndrost

unread,
Aug 17, 2011, 7:49:33 PM8/17/11
to rails_admin
Wow. Yeah, you're right... the master branch readme has the below
notice, but not the 3.0 branch, since it's not being maintained any
more. (The 3.0 readme doesn't mention that it's not maintained
either.) Honestly, I'd recommend against using rails_admin unless
you're on master. Even then, you should expect to need to learn the
internals to debug stuff... this is alpha software. (No offense,
maintainers! It's rad, thanks for your work :) )

Anyway, the alternative is a block in an initializer like this:

RailsAdmin.config do |config|
...
end

------

Configuration with ActiveRecord::Base#rails_admin is not recommended
anymore and should be considered as expermimental (development) until
further notice. Unfortunately, implementation of this feature is
thougher than imagined. Any help is welcome, as usual. Please remove
any rails_admin configuration from your ActiveRecord model and put it
inside an initializer (as shown in this documentation now).

Gady

unread,
Aug 18, 2011, 7:27:33 AM8/18/11
to rails_admin
Thanks!
it solved my problem

msp

unread,
Aug 19, 2011, 10:52:19 AM8/19/11
to rails_admin
Seems to have settled things down for me on the rails-3.0 branch.
Thanks!
Reply all
Reply to author
Forward
0 new messages