Class: Admin::ScaffoldController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::ScaffoldController
- Defined in:
- app/controllers/admin/scaffold_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/admin/scaffold_controller.rb', line 18 def create set_object current_resource_class.new(params[:"#{resource_name}"]) if current_resource.respond_to?("administrator=") current_resource.administrator ||= current_administrator end current_resource.save respond_with(current_resource) end |
#destroy ⇒ Object
35 36 37 38 |
# File 'app/controllers/admin/scaffold_controller.rb', line 35 def destroy current_resource.destroy respond_with(current_resource) end |
#edit ⇒ Object
15 16 |
# File 'app/controllers/admin/scaffold_controller.rb', line 15 def edit end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/admin/scaffold_controller.rb', line 6 def index @search = current_resource_class.search(params[:search]) set_collection @search.page(params[:page] || 1) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/admin/scaffold_controller.rb', line 11 def new set_object current_resource_class.new end |
#update ⇒ Object
29 30 31 32 33 |
# File 'app/controllers/admin/scaffold_controller.rb', line 29 def update current_resource.attributes = params[:"#{resource_name}"] current_resource.save respond_with(current_resource) end |