1

i am new in ROR. and install an gem for admin dashboard named as activeadmin, but now i want to create more curd in that admin gem . i cannnot use scafold because it will create functions in app folder.

please guide me the better approche

3 Answers3

0

To add models in ActiveAdmin panel. You need to add a file with name identical to that of the corresponding model. E-g To add Employee model in activeadmi, add employee.rb file in app/admin folder. In other words create a file app/admin/employee.rb and register columns and actions like by adding the following code.

    ActiveAdmin.register Employee do
     #remove unnesecary UI elements and name report
     config.clear_action_items!
     actions :all, except: [:edit, :destroy]
     config.batch_actions = false
     menu :label => proc{ "Employee Report" }
     #Narrow filters to useful list
     filter :FirstName
     filter :LastName
     filter :Title
     #common queries
    end
umair
  • 66
  • 5
0

Register our three models:

rails generate active_admin:resource Genre
rails generate active_admin:resource Author
rails generate active_admin:resource Book

First, change the columns that are displayed. Active Admin displays columns for all fields that your object has, but in this case we will remove the Created At and Updated At columns and add the author name and genre name columns. This is done within the index method in app/admin/book.rb, where the included columns are specified.

index do
  column :name
  column :author
  column :genre
  column :price
end

Please refer following blog for Active admin CRUD functionality https://www.sitepoint.com/easy-admin-interfaces-active-admin-rails/

0

There is plenty of documentation. There is also a wiki with links to tutorials and sample apps.

Piers C
  • 2,880
  • 1
  • 23
  • 29