100+ results for 'ransack(params[:q])'

Not the results you expected?

orders_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 137 lines

53 def index

54 authorize! :index, Order

55 @orders = Order.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

56 respond_with(@orders)

57 end

88 def mine

89 if current_api_user.persisted?

90 @orders = current_api_user.orders.reverse_chronological.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

91 else

92 render "spree/api/errors/unauthorized", status: :unauthorized

users_controller.rb (https://github.com/fig/spree.git) Ruby · 109 lines

81 return @collection if @collection.present?

82 @collection = super

83 @search = @collection.ransack(params[:q])

84 @collection = @search.result.page(params[:page]).per(Spree::Config[:admin_users_per_page])

85 end

orders_controller.rb (https://github.com/Aeon/spree.git) Ruby · 125 lines

34 end

35

36 @search = Order.ransack(params[:q])

37 @orders = @search.result.includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])

38

return_authorizations_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 71 lines

23 authorize! :admin, ReturnAuthorization

24 @return_authorizations = order.return_authorizations.accessible_by(current_ability, :read).

25 ransack(params[:q]).result.

26 page(params[:page]).per(params[:per_page])

27 respond_with(@return_authorizations)

products_controller.rb (https://github.com/pdamer/spree-1.git) Ruby · 138 lines

102 @collection = @collection.with_deleted if params[:q].delete(:deleted_at_null) == '0'

103 # @search needs to be defined as this is passed to search_form_for

104 @search = @collection.ransack(params[:q])

105 @collection = @search.result.

106 distinct_by_product_ids(params[:q][:s]).

orders_controller.rb (https://github.com/GeekOnCoffee/spree.git) Ruby · 149 lines

35 end

36

37 @search = Order.accessible_by(current_ability, :index).ransack(params[:q])

38

39 # lazyoading other models here (via includes) may result in an invalid query

orders_controller.rb (https://github.com/fabien/spree.git) Ruby · 127 lines

36 end

37

38 @search = Order.ransack(params[:q])

39 @orders = @search.result(:distinct => true).includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])

40

users_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 145 lines

101 .limit(params[:limit] || 100)

102 else

103 @search = @collection.ransack(params[:q])

104 @collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])

105 end

klasses_controller.rb (https://gitlab.com/cd2/developingexperts) Ruby · 87 lines

6 def index

7 if signed_in_as_administrator?

8 @q = @school.klasses.ransack(params[:q])

9 else

10 @q = current_user.klasses.ransack(params[:q])

taxons_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 76 lines

10 @taxons = Taxon.accessible_by(current_ability, :read).where(:id => params[:ids].split(","))

11 else

12 @taxons = Taxon.accessible_by(current_ability, :read).ransack(params[:q]).result

13 end

14 end

taxons_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 98 lines

10 @taxons = Spree::Taxon.includes(:children).accessible_by(current_ability, :read).where(id: params[:ids].split(','))

11 else

12 @taxons = Spree::Taxon.includes(:children).accessible_by(current_ability, :read).order(:taxonomy_id, :lft).ransack(params[:q]).result

13 end

14 end

69 # Products#index does not do the sorting.

70 taxon = Spree::Taxon.find(params[:id])

71 @products = taxon.products.ransack(params[:q]).result

72 @products = @products.page(params[:page]).per(params[:per_page] || 500)

73 render "spree/api/v1/products/index"

teachers_controller.rb (https://gitlab.com/cd2/developingexperts) Ruby · 71 lines

7

8 def index

9 @q = @school.faculty_members.ransack(params[:q])

10 @teachers = @q.result(distinct: true)

11 end

application_controller.rb (https://gitlab.com/cd2/cms) Ruby · 113 lines

33 def index

34 if @resource_driver.respond_to? :ordered

35 @q = @resource_driver.try(:ordered).ransack(params[:q])

36 else

37 @q = @resource_driver.ransack(params[:q])

search_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 50 lines

29 @products = Product.where(id: params[:ids].split(",").flatten)

30 else

31 @products = Product.ransack(params[:q]).result

32 end

33

42 Tag.where(id: params[:ids].split(",").flatten)

43 else

44 Tag.ransack(params[:q]).result

45 end

46 end

shipments_controller.rb (https://github.com/pdamer/spree-1.git) Ruby · 149 lines

13 .where(spree_orders: {user_id: current_api_user.id})

14 .includes(mine_includes)

15 .ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

16 else

17 render "spree/api/errors/unauthorized", status: :unauthorized

products_controller.rb (https://github.com/paulcc/spree.git) Ruby · 144 lines

105 end

106 # @search needs to be defined as this is passed to search_form_for

107 @search = @collection.ransack(params[:q])

108 @collection = @search.result.

109 distinct_by_product_ids(params[:q][:s]).

stock_items_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 77 lines

6

7 def index

8 @stock_items = scope.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

9 respond_with(@stock_items)

10 end

schedules_controller.rb (https://gitlab.com/mdrz_92/prestasala) Ruby · 101 lines

8 @spaces = Space.all

9 @count_schedules = Schedule.count

10 @q = Schedule.ransack(params[:q])

11 @events = @q.result(distinct: true)

12

pupils_controller.rb (https://gitlab.com/cd2/developingexperts) Ruby · 104 lines

11 def index

12 pupil_driver = signed_in_as_administrator? ? @school : current_user

13 @q = pupil_driver.pupils.ransack(params[:q])

14 @pupils = @q.result(distinct: true)

15 end

option_values_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 63 lines

7 @option_values = scope.where(id: params[:ids])

8 else

9 @option_values = scope.ransack(params[:q]).result.distinct

10 end

11 respond_with(@option_values)

reports_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 65 lines

41 params[:q][:s] ||= "completed_at desc"

42

43 @search = Order.complete.ransack(params[:q])

44 @orders = @search.result

45

orders_controller.rb (https://github.com/tomz/spree.git) Ruby · 137 lines

40 def index

41 authorize! :index, Order

42 @orders = Order.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

43 respond_with(@orders)

44 end

68 def mine

69 if current_api_user.persisted?

70 @orders = current_api_user.orders.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

71 else

72 render "spree/api/errors/unauthorized", status: :unauthorized

users_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 60 lines

7

8 def index

9 @users = Spree.user_class.accessible_by(current_ability,:read).ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

10 respond_with(@users)

11 end

return_authorizations_controller.rb (https://github.com/tomz/spree.git) Ruby · 78 lines

22 authorize! :admin, ReturnAuthorization

23 @return_authorizations = order.return_authorizations.accessible_by(current_ability, :read).

24 ransack(params[:q]).result.

25 page(params[:page]).per(params[:per_page])

26 respond_with(@return_authorizations)

pictures_controller.rb (https://github.com/seaneshbaugh/portfolio.git) Ruby · 117 lines

6 authorize Picture

7

8 @search = Picture.ransack(params[:q])

9

10 @pictures = @search.result.page(params[:page]).per(25).reverse_chronological

pages_controller.rb (https://github.com/magiclabs/alchemy_cms.git) Ruby · 129 lines

18 end

19 @pages = @pages.includes(*page_includes)

20 @pages = @pages.ransack(params[:q]).result

21

22 if params[:page]

links_controller.rb (https://github.com/seaneshbaugh/portfolio.git) Ruby · 85 lines

6 authorize Link

7

8 @search = Link.ransack(params[:q])

9

10 @links = @search.result.page(params[:page]).per(25).reverse_chronological

products_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 137 lines

84 params[:q][:s] ||= "name asc"

85 # @search needs to be defined as this is passed to search_form_for

86 @search = super.ransack(params[:q])

87 @collection = @search.result.

88 order(id: :asc).

stock_items_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 68 lines

5

6 def index

7 @stock_items = scope.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

8 respond_with(@stock_items)

9 end

pages_controller.rb (https://github.com/seaneshbaugh/portfolio.git) Ruby · 85 lines

6 authorize Page

7

8 @search = Page.ransack(params[:q])

9

10 @pages = @search.result.page(params[:page]).per(25).by_order

promotions_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 36 lines

22

23 @collection = super

24 @search = @collection.ransack(params[:q])

25 @collection = @search.result(distinct: true).

26 includes(promotion_includes).

product_properties_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 73 lines

8 def index

9 @product_properties = @product.product_properties.accessible_by(current_ability, :read).

10 ransack(params[:q]).result.

11 page(params[:page]).per(params[:per_page])

12 respond_with(@product_properties)

products_controller.rb (git://github.com/spree/spree.git) Ruby · 131 lines

9 product_scope.where(id: params[:ids].split(',').flatten)

10 else

11 product_scope.ransack(params[:q]).result

12 end

13

products_controller.rb (https://github.com/crystalneth/spree.git) Ruby · 123 lines

83 params[:q][:s] ||= "name asc"

84

85 @search = super.ransack(params[:q])

86 @collection = @search.result.

87 group_by_products_id.

stock_transfers_controller.rb (https://github.com/chienyuan/spree.git) Ruby · 53 lines

5

6 def index

7 @q = StockTransfer.ransack(params[:q])

8

9 @stock_transfers = @q.result

option_values_controller.rb (https://github.com/tomz/spree.git) Ruby · 58 lines

6 @option_values = scope.where(:id => params[:ids])

7 else

8 @option_values = scope.ransack(params[:q]).result

9 end

10 respond_with(@option_values)

products_controller.rb (https://github.com/pageman/spree.git) Ruby · 56 lines

8 @products = product_scope.where(:id => params[:ids])

9 else

10 @products = product_scope.ransack(params[:q]).result

11 end

12

product_properties_controller.rb (git://github.com/spree/spree.git) Ruby · 73 lines

8 def index

9 @product_properties = @product.product_properties.accessible_by(current_ability).

10 ransack(params[:q]).result.

11 page(params[:page]).per(params[:per_page])

12 respond_with(@product_properties)

taxonomies_controller.rb (https://gitlab.com/adamlwalker/spree) Ruby · 66 lines

46 def taxonomies

47 @taxonomies = Taxonomy.accessible_by(current_ability, :read).order('name').includes(:root => :children).

48 ransack(params[:q]).result.

49 page(params[:page]).per(params[:per_page])

50 end

wholesalers_controller.rb (https://github.com/citrus/spree_wholesale.git) Ruby · 82 lines

77 params[:search] ||= {}

78 params[:search][:meta_sort] ||= "company.asc"

79 @search = Spree::Wholesaler.ransack(params[:q])

80 @collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])

81 end

taxons_controller.rb (https://github.com/tomz/spree.git) Ruby · 93 lines

9 @taxons = Spree::Taxon.accessible_by(current_ability, :read).where(id: params[:ids].split(','))

10 else

11 @taxons = Spree::Taxon.accessible_by(current_ability, :read).order(:taxonomy_id, :lft).ransack(params[:q]).result

12 end

13 end

65 # Products#index does not do the sorting.

66 taxon = Spree::Taxon.find(params[:id])

67 @products = taxon.products.ransack(params[:q]).result

68 @products = @products.page(params[:page]).per(500 || params[:per_page])

69 render "spree/api/products/index"

search_controller.rb (https://gitlab.com/adamlwalker/spree) Ruby · 41 lines

29 @products = Product.where(id: params[:ids].split(",").flatten)

30 else

31 @products = Product.ransack(params[:q]).result

32 end

33

shipments_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 163 lines

14 .where(spree_orders: {user_id: current_api_user.id})

15 .includes(mine_includes)

16 .ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

17 else

18 render "spree/api/errors/unauthorized", status: :unauthorized

resource_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 87 lines

10 collection_scope = collection_scope.where(id: ids)

11 else

12 collection_scope = collection_scope.ransack(params[:q]).result

13 end

14

taxons_controller.rb (https://github.com/pageman/spree.git) Ruby · 78 lines

11 @taxons = Taxon.where(:id => params[:ids].split(","))

12 else

13 @taxons = Taxon.ransack(params[:q]).result

14 end

15 end

orders_controller.rb (https://github.com/fig/spree.git) Ruby · 155 lines

43 end

44

45 @search = Spree::Order.preload(:user).accessible_by(current_ability, :index).ransack(params[:q])

46

47 # lazy loading other models here (via includes) may result in an invalid query

variants_controller.rb (https://github.com/pdamer/spree-1.git) Ruby · 73 lines

25 def index

26 @variants = scope.includes({ option_values: :option_type }, :product, :default_price, :images, { stock_items: :stock_location })

27 .ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

28 respond_with(@variants)

29 end

variants_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 72 lines

22

23 def index

24 @variants = scope.includes(:option_values).ransack(params[:q]).result.

25 page(params[:page]).per(params[:per_page])

26 respond_with(@variants)

products_controller.rb (https://github.com/chienyuan/spree.git) Ruby · 129 lines

89 @collection = @collection.with_deleted if params[:q].delete(:deleted_at_null).blank?

90 # @search needs to be defined as this is passed to search_form_for

91 @search = @collection.ransack(params[:q])

92 @collection = @search.result.

93 group_by_products_id.

products_controller.rb (https://github.com/jsqu99/spree.git) Ruby · 138 lines

102 @collection = @collection.with_deleted if params[:q].delete(:deleted_at_null).blank?

103 # @search needs to be defined as this is passed to search_form_for

104 @search = @collection.ransack(params[:q])

105 @collection = @search.result.

106 distinct_by_product_ids(params[:q][:s]).

stock_locations_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 52 lines

5 def index

6 authorize! :read, StockLocation

7 @stock_locations = StockLocation.accessible_by(current_ability, :read).order('name ASC').ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

8 respond_with(@stock_locations)

9 end

products_controller.rb (https://github.com/jmbejar/spree.git) Ruby · 115 lines

82 params[:q][:s] ||= "name asc"

83

84 @search = super.ransack(params[:q])

85 @collection = @search.result.

86 group_by_products_id.

orders_controller.rb (https://github.com/jmbejar/spree.git) Ruby · 133 lines

35 end

36

37 @search = Order.accessible_by(current_ability, :index).ransack(params[:q])

38 @orders = @search.result.includes([:user, :shipments, :payments]).

39 page(params[:page]).

orders_controller.rb (https://github.com/slavix/spree.git) Ruby · 131 lines

40 def index

41 authorize! :index, Order

42 @orders = Order.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

43 respond_with(@orders)

44 end

66 def mine

67 if current_api_user.persisted?

68 @orders = current_api_user.orders.reverse_chronological.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

69 else

70 render "spree/api/errors/unauthorized", status: :unauthorized

zones_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 51 lines

21

22 def index

23 @zones = Zone.accessible_by(current_ability, :read).order('name ASC').ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

24 respond_with(@zones)

25 end

products_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 129 lines

8 @products = product_scope.where(id: params[:ids].split(",").flatten)

9 else

10 @products = product_scope.ransack(params[:q]).result

11 end

12

states_controller.rb (https://gitlab.com/adamlwalker/spree) Ruby · 40 lines

8

9 def index

10 @states = scope.ransack(params[:q]).result.

11 includes(:country).order('name ASC')

12

promotions_controller.rb (https://github.com/fig/spree.git) Ruby · 37 lines

23

24 @collection = super

25 @search = @collection.ransack(params[:q])

26 @collection = @search.result(distinct: true).

27 includes(promotion_includes).

option_types_controller.rb (https://github.com/tomz/spree.git) Ruby · 49 lines

6 @option_types = Spree::OptionType.accessible_by(current_ability, :read).where(:id => params[:ids].split(','))

7 else

8 @option_types = Spree::OptionType.accessible_by(current_ability, :read).load.ransack(params[:q]).result

9 end

10 respond_with(@option_types)

taxonomies_controller.rb (https://github.com/tomz/spree.git) Ruby · 64 lines

45 def taxonomies

46 @taxonomies = Taxonomy.accessible_by(current_ability, :read).order('name').includes(:root => :children).

47 ransack(params[:q]).result.

48 page(params[:page]).per(params[:per_page])

49 end

orders_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 149 lines

35 end

36

37 @search = Order.preload(:user).accessible_by(current_ability, :index).ransack(params[:q])

38

39 # lazy loading other models here (via includes) may result in an invalid query

payments_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 82 lines

8

9 def index

10 @payments = @order.payments.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

11 respond_with(@payments)

12 end

orders_controller.rb (https://github.com/eraserx99/spree.git) Ruby · 116 lines

28 end

29

30 @search = Order.ransack(params[:q])

31 @orders = @search.result.includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])

32 respond_with(@orders)

stock_movements_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 45 lines

7 def index

8 authorize! :read, StockMovement

9 @stock_movements = scope.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

10 respond_with(@stock_movements)

11 end

properties_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 61 lines

7 def index

8 @properties = Spree::Property.accessible_by(current_ability, :read).

9 ransack(params[:q]).result.

10 page(params[:page]).per(params[:per_page])

11 respond_with(@properties)

zones_controller.rb (https://github.com/chienyuan/spree.git) Ruby · 46 lines

20

21 def index

22 @zones = Zone.accessible_by(current_ability, :read).order('name ASC').ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

23 respond_with(@zones)

24 end

properties_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 72 lines

12 @properties = @properties.where(id: params[:ids].split(",").flatten)

13 else

14 @properties = @properties.ransack(params[:q]).result

15 end

16

users_controller.rb (https://github.com/chienyuan/spree.git) Ruby · 53 lines

4

5 def index

6 @users = Spree.user_class.accessible_by(current_ability,:read).ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

7 respond_with(@users)

8 end

variants_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 90 lines

27 def index

28 @variants = scope.includes(include_list)

29 .ransack(params[:q]).result

30

31 @variants = paginate(@variants)

payments_controller.rb (https://github.com/tomz/spree.git) Ruby · 94 lines

7

8 def index

9 @payments = @order.payments.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

10 respond_with(@payments)

11 end

products_controller.rb (https://github.com/tomz/spree.git) Ruby · 126 lines

7 @products = product_scope.where(:id => params[:ids].split(","))

8 else

9 @products = product_scope.ransack(params[:q]).result

10 end

11

users_controller.rb (https://github.com/andrewmp1/spree.git) Ruby · 68 lines

25 return @collection if @collection.present?

26 unless request.xhr?

27 @search = Spree::User.registered.ransack(params[:q])

28 @collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])

29 else

enterprises_controller.rb (https://gitlab.com/srihas/openfoodnetwork) Ruby · 70 lines

9

10 def managed

11 @enterprises = Enterprise.ransack(params[:q]).result.managed_by(current_api_user)

12 render params[:template] || :bulk_index

13 end

states_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 36 lines

5

6 def index

7 @states = scope.ransack(params[:q]).result.

8 includes(:country).order('name ASC')

9

orders_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 190 lines

62 @orders = paginate(

63 Spree::Order

64 .ransack(params[:q])

65 .result

66 .includes(orders_includes)

98 def mine

99 if current_api_user

100 @orders = current_api_user.orders.by_store(current_store).reverse_chronological.ransack(params[:q]).result

101 @orders = paginate(@orders)

102 else

taxonomies_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 58 lines

5 def index

6 @taxonomies = Taxonomy.accessible_by(current_ability, :read).order('name').includes(:root => :children).

7 ransack(params[:q]).result.

8 page(params[:page]).per(params[:per_page])

9 last_taxonomy = Spree::Taxonomy.order("updated_at ASC").last

reports_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 55 lines

33 params[:q][:s] ||= "created_at desc"

34

35 @search = Order.complete.ransack(params[:q])

36 @orders = @search.result

37

variants_controller.rb (git://github.com/spree/spree.git) Ruby · 81 lines

26 def index

27 @variants = scope.includes(*variant_includes).for_currency_and_available_price_amount.

28 ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

29 respond_with(@variants)

30 end

return_authorizations_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 81 lines

31 return_authorizations.

32 accessible_by(current_ability).

33 ransack(params[:q]).

34 result

35

stock_locations_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 60 lines

10 accessible_by(current_ability).

11 order('name ASC').

12 ransack(params[:q]).

13 result

14

properties_controller.rb (https://github.com/tomz/spree.git) Ruby · 70 lines

11 @properties = @properties.where(:id => params[:ids].split(","))

12 else

13 @properties = @properties.ransack(params[:q]).result

14 end

15

users_controller.rb (https://github.com/paulcc/spree.git) Ruby · 166 lines

106 .limit(params[:limit] || 100)

107 else

108 @search = Spree.user_class.ransack(params[:q])

109 @collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])

110 end

variants_controller.rb (https://github.com/tomz/spree.git) Ruby · 74 lines

25 def index

26 @variants = scope.includes({ option_values: :option_type }, :product, :default_price, :images, { stock_items: :stock_location })

27 .ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

28

29 respond_with(@variants)

taxons_controller.rb (git://github.com/spree/spree.git) Ruby · 95 lines

11 Spree::Taxon.includes(:children).accessible_by(current_ability).order(:taxonomy_id, :lft)

12 end

13 @taxons = @taxons.ransack(params[:q]).result

14 @taxons = @taxons.page(params[:page]).per(params[:per_page])

15 respond_with(@taxons)

66 # Products#index does not do the sorting.

67 taxon = Spree::Taxon.find(params[:id])

68 @products = taxon.products.ransack(params[:q]).result

69 @products = @products.page(params[:page]).per(params[:per_page] || 500)

70 render 'spree/api/v1/products/index'

taxons_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 126 lines

10 @taxons = Spree::Taxon.accessible_by(current_ability).where(id: params[:ids].split(','))

11 else

12 @taxons = Spree::Taxon.accessible_by(current_ability).order(:taxonomy_id, :lft).ransack(params[:q]).result

13 end

14

74 # Products#index does not do the sorting.

75 taxon = Spree::Taxon.find(params[:id])

76 @products = paginate(taxon.products.ransack(params[:q]).result)

77 @products = @products.includes(master: :default_price)

78

stock_transfers_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 51 lines

5

6 def index

7 @q = StockTransfer.ransack(params[:q])

8

9 @stock_transfers = @q.result.

images_controller.rb (https://gitlab.com/slice-group/speakers-web.git) Ruby · 91 lines

7 # GET /images

8 def index

9 @q = Image.ransack(params[:q])

10 images = @q.result(distinct: true)

11 @objects = images.page(@current_page)

products_controller_decorator.rb (https://gitlab.com/srihas/openfoodnetwork) Ruby · 71 lines

6 authorize! :read, Spree::Product

7

8 @products = product_scope.ransack(params[:q]).result.managed_by(current_api_user).page(params[:page]).per(params[:per_page])

9 respond_with(@products, default_template: :index)

10 end

15 merge(product_scope).

16 order('created_at DESC').

17 ransack(params[:q]).result.

18 page(params[:page]).per(params[:per_page])

19

61 where(supplier_id: producers).

62 by_producer.by_name.

63 ransack(params[:q]).result.

64 page(params[:page]).per(params[:per_page])

65 end

option_types_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 54 lines

7 @option_types = Spree::OptionType.includes(:option_values).accessible_by(current_ability, :read).where(id: params[:ids].split(','))

8 else

9 @option_types = Spree::OptionType.includes(:option_values).accessible_by(current_ability, :read).load.ransack(params[:q]).result

10 end

11 respond_with(@option_types)

books_controller.rb (https://gitlab.com/igorduarte/Library.git) Ruby · 77 lines

7 def index

8 #@books = Book.all

9 @q = Book.ransack(params[:q])

10 @books = @q.result

11 end

chat_channels_controller.rb (https://github.com/thepracticaldev/dev.to.git) Ruby · 58 lines

4

5 def index

6 @q = ChatChannel.where(channel_type: "invite_only").includes(:users).ransack(params[:q])

7 @group_chat_channels = @q.result.page(params[:page]).per(50)

8 end

products_controller.rb (https://github.com/liwei78/rails-practice-code.git) Ruby · 87 lines

9 # GET /products.json

10 def index

11 @q = Product.ransack(params[:q])

12 @q.sorts = 'id desc' if @q.sorts.empty?

13 @products = @q.result(distinct: true)

stock_locations_controller.rb (https://github.com/tomz/spree.git) Ruby · 50 lines

4 def index

5 authorize! :read, StockLocation

6 @stock_locations = StockLocation.accessible_by(current_ability, :read).order('name ASC').ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

7 respond_with(@stock_locations)

8 end

users_controller.rb (https://github.com/fig/spree.git) Ruby · 67 lines

11 @users.ransack(id_in: params[:ids].split(','))

12 else

13 @users.ransack(params[:q])

14 end

15

product_properties_controller.rb (https://github.com/tomz/spree.git) Ruby · 72 lines

8 def index

9 @product_properties = @product.product_properties.accessible_by(current_ability, :read).

10 ransack(params[:q]).result.

11 page(params[:page]).per(params[:per_page])

12 respond_with(@product_properties)

users_controller.rb (https://github.com/brunofacca/zen-rails-base-app.git) Ruby · 97 lines

17 # This ivar is not used in the view, only as input to Ransack. There is

18 # no need to eager load associations here, Ransack avoids N+1 queries.

19 @q = policy_scope(User).ransack(params[:q])

20 # Ransack default (initial) sort order

21 @q.sorts = 'full_name asc' if @q.sorts.empty?

variants_controller.rb (https://gitlab.com/adamlwalker/spree) Ruby · 75 lines

26 def index

27 @variants = scope.includes({ option_values: :option_type }, :product, :default_price, :images, { stock_items: :stock_location })

28 .ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

29 respond_with(@variants)

30 end

orders_controller.rb (https://github.com/crystalneth/spree.git) Ruby · 89 lines

16

17 def search

18 @orders = Order.ransack(params[:q]).result.page(params[:page])

19 render :index

20 end

stock_movements_controller.rb (https://github.com/tomz/spree.git) Ruby · 43 lines

6 def index

7 authorize! :read, StockMovement

8 @stock_movements = scope.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

9 respond_with(@stock_movements)

10 end

return_index_controller.rb (https://gitlab.com/shinvdu/spree) Ruby · 28 lines

20 @collection = resource.all

21 # @search needs to be defined as this is passed to search_form_for

22 @search = @collection.ransack(params[:q])

23 per_page = params[:per_page] || Spree::Config[:admin_products_per_page]

24 @collection = @search.result.order(created_at: :desc).page(params[:page]).per(per_page)

users_controller.rb (git://github.com/fatfreecrm/fat_free_crm.git) Ruby · 152 lines

136 self.current_query = params[:query] if params[:query]

137

138 @search = klass.ransack(params[:q])

139 @search.build_grouping unless @search.groupings.any?

140

orders_controller.rb (https://github.com/joshnuss/spree-1.git) Ruby · 88 lines

33 def index

34 authorize! :index, Order

35 @orders = Order.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])

36 respond_with(@orders)

37 end

option_values_controller.rb (https://gitlab.com/adamlwalker/spree) Ruby · 60 lines

7 @option_values = scope.where(:id => params[:ids])

8 else

9 @option_values = scope.ransack(params[:q]).result.distinct

10 end

11 respond_with(@option_values)

orders_controller.rb (https://github.com/crystalneth/spree.git) Ruby · 130 lines

36 end

37

38 @search = Order.ransack(params[:q])

39 @orders = @search.result(:distinct => true).

40 includes([:user, :shipments, :payments]).

promotions_controller.rb (https://github.com/solidusio/solidus.git) Ruby · 67 lines

47

48 @collection = super

49 @search = @collection.ransack(params[:q])

50 @collection = @search.result(distinct: true).

51 includes(promotion_includes).