Create action balance on dashboard

225 views
Skip to first unread message

Maria Serrano Cáceres

unread,
Oct 23, 2012, 9:35:58 AM10/23/12
to rails...@googlegroups.com
I don't understand very good yet how it works rails_admin gem for create a new action.

I want create a action "balance" in root.

I have created a file with name "rails_admin_balance.rb" 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!

Carlos Castillo

unread,
Nov 29, 2012, 3:19:20 PM11/29/12
to rails...@googlegroups.com
I was trying to do the same and i cant, what i did was create a new custom action like a plugin:


there are the instructions for that, is really simple!!!!
Reply all
Reply to author
Forward
0 new messages