Permalink
Browse files

Switching from Order BETWEEN Sql fragment to AR Range

  • Loading branch information...
1 parent 705da27 commit 8a617b71bc387c7e6fd1bfb14b4abcb5c98216ef @GeekOnCoffee GeekOnCoffee committed with radar May 22, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/app/models/spree/order.rb
@@ -52,7 +52,7 @@ class Order < ActiveRecord::Base
validate :has_available_payment
scope :by_number, lambda { |number| where(:number => number) }
- scope :between, lambda { |*dates| where('created_at BETWEEN ? AND ?', dates.first.to_date, dates.last.to_date) }
+ scope :between, lambda { |*dates| where(:created_at => [dates.first.to_date, dates.last.to_date]) }
scope :by_customer, lambda { |customer| joins(:user).where("#{Spree::User.table_name}.email = ?", customer) }
scope :by_state, lambda { |state| where(:state => state) }
scope :complete, where('completed_at IS NOT NULL')

0 comments on commit 8a617b7

Please sign in to comment.