Sha256: 44bbd7f33133849dfb22ada3b1827ebeeb95a16f5c2503e9c35ef02f0cab23b8

Contents?: true

Size: 742 Bytes

Versions: 4

Compression:

Stored size: 742 Bytes

Contents

module RailsStuff
  module ResourcesController
    # Basic actions for resources controller.
    module Actions
      def new
        build_resource
      end

      def create(options = {}, &block)
        if create_resource
          options[:location] ||= after_save_url
        end
        respond_with(resource, options, &block)
      end

      def update(options = {}, &block)
        if update_resource
          options[:location] ||= after_save_url
        end
        respond_with(resource, options, &block)
      end

      def destroy(options = {}, &block)
        resource.destroy
        options[:location] ||= after_destroy_url
        flash_errors!
        respond_with(resource, options, &block)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_stuff-0.6.0 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.6.0.rc3 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.6.0.rc2 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.6.0.rc1 lib/rails_stuff/resources_controller/actions.rb