module InheritedResources::Actions

Holds all default actions for InheritedResources.

Public Instance Methods

create(options={}, &block) click to toggle source

POST /resources

# File lib/inherited_resources/actions.rb, line 32
def create(options={}, &block)
  object = build_resource

  if create_resource(object)
    options[:location] ||= smart_resource_url
  end

  respond_with_dual_blocks(object, options, &block)
end
Also aliased as: create!
destroy(options={}, &block) click to toggle source

DELETE /resources/1

# File lib/inherited_resources/actions.rb, line 56
def destroy(options={}, &block)
  object = resource
  options[:location] ||= smart_collection_url

  destroy_resource(object)
  respond_with_dual_blocks(object, options, &block)
end
Also aliased as: destroy!
edit(options={}, &block) click to toggle source

GET /resources/1/edit

# File lib/inherited_resources/actions.rb, line 26
def edit(options={}, &block)
  respond_with(*with_chain(resource), options, &block)
end
Also aliased as: edit!
index(options={}, &block) click to toggle source

GET /resources

# File lib/inherited_resources/actions.rb, line 8
def index(options={}, &block)
  respond_with(*with_chain(collection), options, &block)
end
Also aliased as: index!
new(options={}, &block) click to toggle source

GET /resources/new

# File lib/inherited_resources/actions.rb, line 20
def new(options={}, &block)
  respond_with(*with_chain(build_resource), options, &block)
end
Also aliased as: new!
show(options={}, &block) click to toggle source

GET /resources/1

# File lib/inherited_resources/actions.rb, line 14
def show(options={}, &block)
  respond_with(*with_chain(resource), options, &block)
end
Also aliased as: show!
update(options={}, &block) click to toggle source

PUT /resources/1

# File lib/inherited_resources/actions.rb, line 44
def update(options={}, &block)
  object = resource

  if update_resource(object, resource_params)
    options[:location] ||= smart_resource_url
  end

  respond_with_dual_blocks(object, options, &block)
end
Also aliased as: update!

Protected Instance Methods

create!(options={}, &block)
Alias for: create
destroy!(options={}, &block)
Alias for: destroy
edit!(options={}, &block)
Alias for: edit
index!(options={}, &block)
Alias for: index
new!(options={}, &block)
Alias for: new
show!(options={}, &block)
Alias for: show
update!(options={}, &block)
Alias for: update