Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove action for model in rails_admin

I have a problem. In my app I am using rails_admin gem. Everything is good except one thing. For some models I want to make possible only to delete them. Is there an easy way to do this?

like image 666
Pavel Avatar asked Jul 11 '12 12:07

Pavel


2 Answers

In your rails_admin.rb file, you can add the default actions for your models in wich you can add exceptions as shown here.

Here is an exemple :

config.actions do
    dashboard                     # mandatory
    index                         # mandatory
    new do
      except ['SomeModel']
    end
    export
    bulk_delete
    show
    edit do
      except ['SomeOtherModel']
    end
    delete
    show_in_app
end

Here is the link to the rails_admin documentation about actions : https://github.com/sferik/rails_admin/wiki/Actions

like image 128
Edmond Lafay-David Avatar answered Nov 14 '22 21:11

Edmond Lafay-David


try changing in the file: config/initilizers/rails_admin.rb you can comment out the actions that you don't want to allow!

like image 1
FedeX Avatar answered Nov 14 '22 22:11

FedeX