aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorFranck Verrot <franck@verrot.fr>2011-01-25 23:27:27 +0100
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-02 12:44:53 -0200
commit5178e641750d4e3f8419c8e6cf3ab7e7cb48a880 (patch)
tree2a69ddff8802abfa008cf1d80d9accf57d7d2064 /activerecord/lib
parent598b32c5812e428f639c9a80b352aec54f059a36 (diff)
downloadrails-5178e641750d4e3f8419c8e6cf3ab7e7cb48a880.tar.gz
rails-5178e641750d4e3f8419c8e6cf3ab7e7cb48a880.tar.bz2
rails-5178e641750d4e3f8419c8e6cf3ab7e7cb48a880.zip
Added timestamp_attributes_for_create_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/timestamp.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb
index 5617adea1f..38cc2c9694 100644
--- a/activerecord/lib/active_record/timestamp.rb
+++ b/activerecord/lib/active_record/timestamp.rb
@@ -66,6 +66,10 @@ module ActiveRecord
self.record_timestamps && (!partial_updates? || changed? || (attributes.keys & self.class.serialized_attributes.keys).present?)
end
+ def timestamp_attributes_for_create_in_model
+ timestamp_attributes_for_create.select { |c| self.class.column_names.include?(c.to_s) }
+ end
+
def timestamp_attributes_for_update_in_model
timestamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) }
end