Class: Administer::EntitiesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Administer::EntitiesController
- Defined in:
- app/controllers/administer/entities_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/administer/entities_controller.rb', line 12 def create @object = model_class.new handle_has_one @object.attributes= @model_params if @object.save redirect_to administer_entities_path(:model_name => model_class.model_name) else render :new end end |
#destroy ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/administer/entities_controller.rb', line 37 def destroy @object = model_class.find(params[:id]) unless @object.destroy flash[:error] = "Could not destroy object." end redirect_to administer_entities_path(:model_name => model_class.model_name) end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/administer/entities_controller.rb', line 23 def edit @object = model_class.find(params[:id]) end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/administer/entities_controller.rb', line 8 def new @object = model_class.new end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/administer/entities_controller.rb', line 27 def update @object = model_class.find(params[:id]) handle_has_one if @object.update_attributes(@model_params) redirect_to administer_entities_path(:model_name => model_class.model_name) else render :edit end end |