
Untitled
By: a guest on
May 25th, 2012 | syntax:
None | size: 0.42 KB | hits: 12 | expires: Never
=begin
'frozen' value for end_at in scope :active
The same frozen value is propogated to :national scope!
The Time.now will be set to the first time the scope is evaluated.
This is explained at http://api.rubyonrails.org/classes/ActiveRecord/NamedScope/ClassMethods.html
* NON-WORKING SOLUTION *
=end
class Something
scope :active, where('end_at > ?', Time.now)
scope :national, where(:is_national => true).active
end