Last active
December 24, 2015 16:19
-
-
Save ehoch/6826660 to your computer and use it in GitHub Desktop.
Gist of our rails_admin mountable engine config solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RailsAdmin | |
module PostConfig | |
def self.extended(base) | |
base.class_eval do | |
rails_admin do | |
weight -10 | |
list(&base.rails_admin_list_fields) | |
edit(&base.rails_admin_edit_fields) | |
edit(&base.rails_admin_edit_extra_fields) | |
end | |
end | |
end | |
def rails_admin_list_fields | |
proc do | |
sort_by :published_at | |
field :title | |
end | |
end | |
def rails_admin_extra_fields | |
proc { } | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RailsAdmin::PostConfig.module_eval do | |
def rails_admin_edit_extra_fields | |
proc do | |
field :new_field | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment