Permalink
Browse files

.search methods changed to .ransack

Closes #1532
  • Loading branch information...
ademidov authored and radar committed May 13, 2012
1 parent b7b20ce commit 4fabc5289643ba4e34edb8a6e348fcb36750f65a
@@ -15,7 +15,7 @@ def show
end
def search
@orders = Order.search(params[:q]).result.page(params[:page])
@orders = Order.ransack(params[:q]).result.page(params[:page])
render :index
end
@@ -7,7 +7,7 @@ def index
end
def search
@products = product_scope.search(params[:q]).result.page(params[:page])
@products = product_scope.ransack(params[:q]).result.page(params[:page])
render :index
end
@@ -27,7 +27,7 @@ def index
params[:q][:completed_at_lt] = params[:q].delete(:created_at_lt)
end
@search = Order.search(params[:q])
@search = Order.ransack(params[:q])
@orders = @search.result.includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])
respond_with(@orders)
end
@@ -64,8 +64,8 @@ def json_data
when 'basic'
collection.map {|p| {'id' => p.id, 'name' => p.name}}.to_json
else
collection.to_json(:include => {:variants => {:include => {:option_values => {:include => :option_type},
:images => {:only => [:id], :methods => :mini_url}}},
collection.to_json(:include => {:variants => {:include => {:option_values => {:include => :option_type},
:images => {:only => [:id], :methods => :mini_url}}},
:images => {:only => [:id], :methods => :mini_url}, :master => {}})
end
end
@@ -84,7 +84,7 @@ def collection
params[:q][:s] ||= "name asc"
@search = super.search(params[:q])
@search = super.ransack(params[:q])
@collection = @search.result.
group_by_products_id.
includes([:master, {:variants => [:images, :option_values]}]).
@@ -34,7 +34,7 @@ def sales_total
params[:q][:meta_sort] ||= "created_at.desc"
@search = Order.complete.search(params[:q])
@search = Order.complete.ransack(params[:q])
@orders = @search.result
@item_total = @orders.sum(:item_total)
@adjustment_total = @orders.sum(:adjustment_total)
@@ -24,7 +24,7 @@ def dismiss_banner
def collection
return @collection if @collection.present?
unless request.xhr?
@search = Spree::User.registered.search(params[:q])
@search = Spree::User.registered.ransack(params[:q])
@collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])
else
#disabling proper nested include here due to rails 3.1 bug
@@ -13,7 +13,7 @@ def new
def collection
params[:q] ||= {}
params[:q][:meta_sort] ||= "ascend_by_name"
@search = super.search(params[:q])
@search = super.ransack(params[:q])
@zones = @search.result.page(params[:page]).per(Spree::Config[:orders_per_page])
end

0 comments on commit 4fabc52

Please sign in to comment.