I don't understand very good yet how it works rails_admin gem for create a new action.
I want create a action with name balance in rails_admin root.
I have created a file with name rails_admin_balance.rb inside myapp/lib folder like:
require 'rails_admin/config/actions'
require 'rails_admin/config/actions/base'
module RailsAdminBalance
end
module RailsAdmin
module Config
module Actions
class Balance < RailsAdmin::Config::Actions::Base
RailsAdmin::Config::Actions.register(self)
register_instance_option :object_level do
true
end
register_instance_option :link_icon do
'icon-eye-open'
end
register_instance_option :root? do
true
end
end
end
end
end
I have created a new file on /views/rails_admin/main/balance.html.erb
inside my rails_admin.rb
file I have
config.actions do
dashboard # mandatory
# collection actions
index # mandatory
new
export
history_index
bulk_delete
# member actions
show
edit
delete
history_show
show_in_app
balance
end
When I try run rails server I get this error:
Exiting
/home/ubuntu/Desktop/myapp/config/initializers/rails_admin.rb:33:in `block (2 levels) in <top (required)>': undefined method `balance' for RailsAdmin::Config::Actions:Module (NoMethodError)....
Where have I the error?
What am I doing bad?
Thank you very much!