Sha256: c83a9f23efbb73a676a0fd3a47559d1cc36806f68f11db3f1e5e0c02f9d8692f

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

require 'inherited_resources'

module Espresso
  class ObjectsController < InheritedResources::Base
    unloadable

    # Same as default InheritedResources::Base#new, but render 'edit' view,
    # other than 'new'
    def new
      new! do |format|
        format.html { render 'edit' }
      end
    end

    # Same as default InheritedResources::Base#create, but render 'edit' view,
    # other than 'new'
    def create
      create! do |success, failure|
        failure.html { render 'edit' }
      end
    end

  protected

    # Find collection of objects with pagination.
    # Also made Searchlogic object @search
    #
    # @return [WillPaginate::Collection] collection of objects
    def collection
      unless (result = get_collection_ivar).present?
        @search, result = end_of_association_chain.paginate_found(params[:page], params[:query], params[:q])
        set_collection_ivar(result)
      end
      result
    end

    # Build interpolation options for flash messages
    def interpolation_options
      { :resource_title => resource.to_s }
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
krasivotokak-espresso-0.0.15 lib/espresso/objects_controller.rb
krasivotokak-espresso-0.0.16 lib/espresso/objects_controller.rb
krasivotokak-espresso-0.0.7 lib/espresso/objects_controller.rb
krasivotokak-espresso-0.0.8 lib/espresso/objects_controller.rb
krasivotokak-espresso-0.0.9 lib/espresso/objects_controller.rb
espresso-0.1.0 lib/espresso/objects_controller.rb
espresso-0.0.16 lib/espresso/objects_controller.rb
espresso-0.0.15 lib/espresso/objects_controller.rb
espresso-0.0.14 lib/espresso/objects_controller.rb
espresso-0.0.12 lib/espresso/objects_controller.rb
espresso-0.0.11 lib/espresso/objects_controller.rb
espresso-0.0.10 lib/espresso/objects_controller.rb
espresso-0.0.9 lib/espresso/objects_controller.rb
espresso-0.0.8 lib/espresso/objects_controller.rb
espresso-0.0.7 lib/espresso/objects_controller.rb