Skip to content

Instantly share code, notes, and snippets.

@Marchino
Created September 9, 2011 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marchino/1205870 to your computer and use it in GitHub Desktop.
Save Marchino/1205870 to your computer and use it in GitHub Desktop.
module Mmplus
module Controllers
module Items
extend ActiveSupport::Concern
included do
before_filter :set_instance
def index
do_search(params[:search] || {}, @instance)
end
def show
@item = @instance.find(params[:id])
@shipping_costs = load_shipping_costs(@item, params[:country] || session[:user_data][:country])
@mlt = @item.more_like_this do
fields :title_it, :title_en, :author, :subjects_it, :subjects_en
paginate(:page => 1, :per_page => 5)
end
end
private
def set_instance
@instance = self.controller_name.singularize.camelize.constantize
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment