Module: RailsStuff::ResourcesController::Actions
- Defined in:
- lib/rails_stuff/resources_controller/actions.rb
Overview
Basic actions for resources controller.
Instance Method Summary collapse
- #create(options = {}, &block) ⇒ Object
- #destroy(options = {}, &block) ⇒ Object
- #new ⇒ Object
- #update(options = {}, &block) ⇒ Object
Instance Method Details
#create(options = {}, &block) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rails_stuff/resources_controller/actions.rb', line 9 def create( = {}, &block) if create_resource [:location] ||= after_save_url end respond_with(resource, , &block) end |
#destroy(options = {}, &block) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rails_stuff/resources_controller/actions.rb', line 23 def destroy( = {}, &block) resource.destroy [:location] ||= after_destroy_url flash_errors! respond_with(resource, , &block) end |
#new ⇒ Object
5 6 7 |
# File 'lib/rails_stuff/resources_controller/actions.rb', line 5 def new build_resource end |
#update(options = {}, &block) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rails_stuff/resources_controller/actions.rb', line 16 def update( = {}, &block) if update_resource [:location] ||= after_save_url end respond_with(resource, , &block) end |