Sha256: 75a61b2f235ed136b9844168d1d11ccb46e2798930fe1e33a8a4cb636bf4407b

Contents?: true

Size: 1.35 KB

Versions: 20

Compression:

Stored size: 1.35 KB

Contents

module ResourceController
  module Actions

    def index
      load_collection
      before :index
      response_for :index
    end

    def show
      load_object
      before :show
      response_for :show
    rescue ActiveRecord::RecordNotFound
      response_for :show_fails
    end

    def create
      build_object
      load_object
      before :create
      if object.save
        after :create
        set_flash :create
        response_for :create
      else
        after :create_fails
        set_flash :create_fails
        response_for :create_fails
      end
    end

    def update
      load_object
      before :update
      if object.update_attributes object_params
        after :update
        set_flash :update
        response_for :update
      else
        after :update_fails
        set_flash :update_fails
        response_for :update_fails
      end
    end

    def new
      build_object
      load_object
      before :new_action
      response_for :new_action
    end

    def edit
      load_object
      before :edit
      response_for :edit
    end

    def destroy
      load_object
      before :destroy
      if object.destroy
        after :destroy
        set_flash :destroy
        response_for :destroy
      else
        after :destroy_fails
        set_flash :destroy_fails
        response_for :destroy_fails
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
spree-0.11.4 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
makandra_resource_controller-0.8.0 lib/resource_controller/actions.rb
resources_controller-1.0.4 lib/resource_controller/actions.rb
resources_controller-1.0.3 lib/resource_controller/actions.rb
resources_controller-1.0.2 lib/resource_controller/actions.rb
makandra_resource_controller-0.7.3 lib/resource_controller/actions.rb
spree-0.11.3 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
makandra_resource_controller-0.7.2 lib/resource_controller/actions.rb
rd_resource_controller-1.0.1 lib/resource_controller/actions.rb
rd_resource_controller-1.0.0 lib/resource_controller/actions.rb
spree-0.11.2 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
makandra_resource_controller-0.7.1 lib/resource_controller/actions.rb
makandra_resource_controller-0.7.0 lib/resource_controller/actions.rb
spree-0.11.1 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
rd_resource_controller-1.0.0.rc lib/resource_controller/actions.rb
spree-0.11.0 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
spree-0.10.2 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
spree-0.10.1 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
spree-0.10.0 vendor/plugins/resource_controller/lib/resource_controller/actions.rb
spree-0.10.0.beta vendor/plugins/resource_controller/lib/resource_controller/actions.rb