Skip to content

Instantly share code, notes, and snippets.

@radar
Last active August 29, 2015 13:55
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 radar/8769321 to your computer and use it in GitHub Desktop.
Save radar/8769321 to your computer and use it in GitHub Desktop.
def more_products_link
object = @store || @tag || @collection
link_to 'Load More Products', [object, :view], :class => 'load-more-products', :remote => true if @products.next_page
end
def tile
# /t/:tag Show all by tag
# /s/:store_slug Show all by store
# /c/:collection_slug Show all by collection
# Nothing passed Show all by rank
if params[:tag]
# find by tag
# to be implemented
# @tag = Tag.friendly.find(params[:tag_slug])
elsif params[:store_slug]
@store = Store.friendly.find(params[:store_slug])
@products = @store.products
elsif params[:collection_slug]
@collection = Collection.friendly.find(params[:collection_slug])
@products = @collection.products
else
@products = Product
end
@products = @products.paginate(:page => params[:page]).order('rank DESC')
respond_to do |format|
format.html
format.json
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment