Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dangerous query method warning #2922

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/app/models/spree/shipment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Shipment < Spree::Base
scope :trackable, -> { where("tracking IS NOT NULL AND tracking != ''") }
scope :with_state, ->(*s) { where(state: s) }
# sort by most recent shipped_at, falling back to created_at. add "id desc" to make specs that involve this scope more deterministic.
scope :reverse_chronological, -> { order('coalesce(spree_shipments.shipped_at, spree_shipments.created_at) desc', id: :desc) }
scope :reverse_chronological, -> { order(Arel::Nodes::NamedFunction.new('COALESCE', [arel_table[:shipped_at], arel_table[:created_at]]).desc, id: :desc) }
scope :by_store, ->(store) { joins(:order).merge(Spree::Order.by_store(store)) }

# shipment state machine (see http://github.com/pluginaweek/state_machine/tree/master for details)
Expand Down