What matters is:
- the filename must end in "_helper.rb"
- the module name must be the camel-case of the file name
- the file must be in app/helpers/active_admin/ directory.
the first helper:
# app/helpers/active_admin/foo_helper.rb
module ActiveAdmin::FooHelper
def foo
"i pity the foo!!!"
end
end
the second helper:
# app/helpers/active_admin/bar_helper.rb
module ActiveAdmin::BarHelper
def bar
"i raise the bar!!!"
end
end
and methods from both are available in view methods across models like so:
# app/admin/users.rb
ActiveAdmin.register User do
#...
show do |user|
row "Test Both Helper" do |user|
# both helper methods work here
foo
bar
end
end
#...
end
and in the view method for a different model...
# app/admin/company.rb
ActiveAdmin.register Company do
# ...
show do |company|
row "Test Both Helpers" do |company|
# both helper methods available here too
foo
bar
end
end
# ...
end
Should the helper be required or something?
I can not use the 'panel' helper.
Thanks a lot!