GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Feature idea: Permit configuration of each model class to be embedded within the model classes.
In addition to:
RailsAdmin.config do |config|
config.model Team do
class Team < ActiveRecord::Base
And even permit:
I really like example 2. I think it makes a lot of sense to include the model's admin configuration in the model itself.
Not sure how I feel about the last example, but it seems at least as good (if not better) than what we have now.
@kaapa: I'd be curious to get your thoughts on any implementation challenges associated with this.
I guess we could simply define method rails_admin in ActiveRecord::Base which would just proxy to RailsAdmin::Config.model(self).
Models classes being managed by RailsAdmin will no longer be eager-loaded automatically in development (using the model class constants in the RailsAdmin initializer loads the model classes). Instead, RailsAdmin will have to load them all explicitly. RailsAdmin's initializer should take care to clear and reload the model classes' configurations cache (to clear out the prior request's configuration) on, if classes are cached, initialization, and, if classes are not cached (in development) on every request that makes it to ActionDispatch.
Allow configuration within model classes, discussed in #275 and #289. F…
Revert "Allow configuration within model classes, discussed in #275 and
#289. Fixes #275"
This reverts commit fb33469.
#289. Fixes #275"
This reverts commit d035100.