module CustomTimestamps::Rails3Model
Private Instance Methods
create()
click to toggle source
Calls superclass method
# File lib/activerecord-custom_timestamps/rails3_model.rb, line 16 def create if self.record_timestamps current_time = current_time_from_proper_timezone Array.wrap(self.created_timestamp).each do |column| if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil? write_attribute(column.to_s, current_time) end end if self.update_custom_updated_timestamp_on_create Array.wrap(self.updated_timestamp).each do |column| column = column.to_s next if attribute_changed?(column) write_attribute(column, current_time) end end end super end
update(*args)
click to toggle source
Calls superclass method
# File lib/activerecord-custom_timestamps/rails3_model.rb, line 38 def update(*args) if should_record_timestamps? current_time = current_time_from_proper_timezone Array.wrap(self.updated_timestamp).each do |column| column = column.to_s next if attribute_changed?(column) write_attribute(column, current_time) end end super end