Skip to content

Instantly share code, notes, and snippets.

@tejo
Created October 12, 2009 09:15
Show Gist options
  • Select an option

  • Save tejo/208280 to your computer and use it in GitHub Desktop.

Select an option

Save tejo/208280 to your computer and use it in GitHub Desktop.
class ProductsController < InheritedResources::Base
respond_to :html, :xml
def reorder
Product.save_order(params['table-products'])
respond_to do |format|
format.js { render 'collections/reorder' }
end
end
def index
index! do |format|
format.xml {
@products = Product.collection_id_equals(params[:collection_id]).ascend_by_position
}
end
end
protected
def collection
@search = Product.search({:order => :ascend_by_position}.merge!(params[:search] || {}))
@products = @search.all.paginate(:page => params[:page])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment