module InheritedResources::Actions

def create(options={}, &block)

POST /resources
def create(options={}, &block)
  object = build_resource
  if create_resource(object)
    options[:location] ||= resource_url rescue nil
  end
  respond_with_dual_blocks(object, options, &block)
end

def destroy(options={}, &block)

DELETE /resources/1
def destroy(options={}, &block)
  object = resource
  options[:location] ||= collection_url rescue nil
  destroy_resource(object)
  respond_with_dual_blocks(object, options, &block)
end

def edit(options={}, &block)

GET /resources/1/edit
def edit(options={}, &block)
  respond_with(*(with_chain(resource) << options), &block)
end

def index(options={}, &block)

GET /resources
def index(options={}, &block)
  respond_with(*(with_chain(collection) << options), &block)
end

def new(options={}, &block)

GET /resources/new
def new(options={}, &block)
  respond_with(*(with_chain(build_resource) << options), &block)
end

def show(options={}, &block)

GET /resources/1
def show(options={}, &block)
  respond_with(*(with_chain(resource) << options), &block)
end

def update(options={}, &block)

PUT /resources/1
def update(options={}, &block)
  object = resource
  if update_resource(object, params[resource_instance_name])
    options[:location] ||= resource_url rescue nil
  end
  respond_with_dual_blocks(object, options, &block)
end