Sha256: cc2dd5cf615877a2a2a12bd70a376c94484abbafd8e1e10ac6c39ee54b157238

Contents?: true

Size: 736 Bytes

Versions: 5

Compression:

Stored size: 736 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

5 entries across 5 versions & 1 rubygems

Version Path
rails_stuff-0.5.1 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.5.0 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.4.0 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.3.0 lib/rails_stuff/resources_controller/actions.rb
rails_stuff-0.2.0 lib/rails_stuff/resources_controller/actions.rb