Sha256: cc99a940b8a46e81942087c5d6f8b477f616f5de2b929f0decd3cf66fecf5624
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'inherited_resources' require 'inherited_resources/actions' require 'inherited_resources/responder' module InheritedResources # redirect to edit_resource_url instead of resource_url module Actions def create(options={}, &block) object = build_resource if create_resource(object) options[:location] ||= edit_resource_url rescue nil # change here 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] ||= edit_resource_url rescue nil # change here 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 destroy_resource(object) options[:alert] = object.errors.full_messages.first # display the first error if present respond_with_dual_blocks(object, options, &block) end alias :destroy! :destroy end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
locomotive_cms-0.0.4 | lib/locomotive/inherited_resources.rb |