aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-12-28 23:47:10 +0100
committerXavier Noria <fxn@hashref.com>2011-12-28 23:47:31 +0100
commit7a80ac0162ae84cf22c91646690ad18916a66274 (patch)
tree2833180fe84884fab88bdc4bad588139bd05b9f9 /activerecord/lib
parentbbafe73d8fe718cff1b8e6ca6b490c4b7e0b40c5 (diff)
downloadrails-7a80ac0162ae84cf22c91646690ad18916a66274.tar.gz
rails-7a80ac0162ae84cf22c91646690ad18916a66274.tar.bz2
rails-7a80ac0162ae84cf22c91646690ad18916a66274.zip
app code in general wants Time.current, not Time.now
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/scoping/named.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index 17122740da..0edc3f1dcc 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -118,16 +118,16 @@ module ActiveRecord
# when they are used. For example, the following would be incorrect:
#
# class Post < ActiveRecord::Base
- # scope :recent, where('published_at >= ?', Time.now - 1.week)
+ # scope :recent, where('published_at >= ?', Time.current - 1.week)
# end
#
- # The example above would be 'frozen' to the <tt>Time.now</tt> value when the <tt>Post</tt>
+ # The example above would be 'frozen' to the <tt>Time.current</tt> value when the <tt>Post</tt>
# class was defined, and so the resultant SQL query would always be the same. The correct
# way to do this would be via a lambda, which will re-evaluate the scope each time
# it is called:
#
# class Post < ActiveRecord::Base
- # scope :recent, lambda { where('published_at >= ?', Time.now - 1.week) }
+ # scope :recent, lambda { where('published_at >= ?', Time.current - 1.week) }
# end
#
# Named \scopes can also have extensions, just as with <tt>has_many</tt> declarations: