Class: Smithy::ContentResourcesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Smithy::ContentResourcesController
- Defined in:
- app/controllers/smithy/content_resources_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 27 def create @record = new_record @record.save flash.notice = "Your #{klass_name} was created" if @record.persisted? respond_with @record do |format| format.html { @record.persisted? ? redirect_to(:action => :index) : render(:action => 'new') } end end |
#destroy ⇒ Object
50 51 52 53 54 55 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 50 def destroy @record = find_record @record.destroy flash.notice = "Your #{klass_name} was deleted" respond_with @record end |
#edit ⇒ Object
36 37 38 39 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 36 def edit @record = find_record respond_with @record end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 12 def index @records = find_records respond_with @records end |
#new ⇒ Object
22 23 24 25 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 22 def new @record = new_record respond_with @record end |
#show ⇒ Object
17 18 19 20 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 17 def show @record = find_record respond_with @record end |
#update ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'app/controllers/smithy/content_resources_controller.rb', line 41 def update @record = find_record @saved = update_record(@record) flash.notice = "Your #{klass_name} was saved" if @saved respond_with @page_content do |format| format.html { @saved ? redirect_to(:action => :index) : render(:action => "edit") } end end |