diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-12-01 19:47:14 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-12-01 19:47:14 +0100 |
commit | 535853e83b9092078035a5abb2aa242fba815c05 (patch) | |
tree | de6348b219aaf625b2c0c651e4b5ff822c883a6e /activerecord/lib | |
parent | 218c2729384be487b7b743a58ac39753cb5a8856 (diff) | |
download | rails-535853e83b9092078035a5abb2aa242fba815c05.tar.gz rails-535853e83b9092078035a5abb2aa242fba815c05.tar.bz2 rails-535853e83b9092078035a5abb2aa242fba815c05.zip |
Added ActiveRecord::Base#last_modified to work with the new fresh_when/stale? conditional get methods from Action Pack
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 76aa121ade..bae2dc738e 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1702,6 +1702,13 @@ MSG end end + # By default returns the value of the updated_at attribute, but can be overwritten to + # provide another indicator of when this record was last updated. This is used by + # ActionControllers conditional get fresh_when/stale? methods. + def last_modified + self[:updated_at] + end + def quoted_id #:nodoc: quote_value(id, column_for_attribute(self.class.primary_key)) end |