lib/inherited_resources/actions.rb in karsthammer-inherited_resources-1.1.2.1 vs lib/inherited_resources/actions.rb in karsthammer-inherited_resources-1.2.1
- old
+ new
@@ -29,32 +29,32 @@
# POST /resources
def create(options={}, &block)
object = build_resource
if create_resource(object)
- options[:location] ||= resource_url rescue nil
+ options[:location] ||= smart_resource_url
end
respond_with_dual_blocks(object, options, &block)
end
alias :create! :create
# PUT /resources/1
def update(options={}, &block)
object = resource
- if update_resource(object, params[resource_instance_name])
- options[:location] ||= resource_url rescue nil
+ if update_resource(object, resource_params)
+ options[:location] ||= smart_resource_url
end
respond_with_dual_blocks(object, options, &block)
end
alias :update! :update
# DELETE /resources/1
def destroy(options={}, &block)
object = resource
- options[:location] ||= collection_url rescue nil
+ options[:location] ||= smart_collection_url
destroy_resource(object)
respond_with_dual_blocks(object, options, &block)
end
alias :destroy! :destroy