module RailsStuff::ResourcesController::Actions

Basic actions for resources controller.

Public Instance Methods

create(options = {}, &block) click to toggle source
# File lib/rails_stuff/resources_controller/actions.rb, line 9
def create(options = {}, &block)
  if create_resource
    options[:location] ||= after_save_url
  end
  respond_with(resource, options, &block)
end
destroy(options = {}, &block) click to toggle source
# File lib/rails_stuff/resources_controller/actions.rb, line 23
def destroy(options = {}, &block)
  resource.destroy
  options[:location] ||= after_destroy_url
  flash_errors!
  respond_with(resource, options, &block)
end
new() click to toggle source
# File lib/rails_stuff/resources_controller/actions.rb, line 5
def new
  build_resource
end
update(options = {}, &block) click to toggle source
# File lib/rails_stuff/resources_controller/actions.rb, line 16
def update(options = {}, &block)
  if update_resource
    options[:location] ||= after_save_url
  end
  respond_with(resource, options, &block)
end