Thursday, September 05, 2013

Disable Edit and Delete in Rails Admin

Add the following code to rails_admin.rb:


  RailsAdmin.config do |config|
    config.actions do
      # root actions
      dashboard                     # mandatory
      # collection actions
      index                         # mandatory
      new
      export
      history_index
      # member actions
      show
      history_show
      show_in_app
    end
  end

As you can see from above, there is no edit or delete actions defined. Now you will not be able to edit or delete the models when you are logged in as admin.