Module: MassiveRecord::ORM::Timestamps

Extended by:
ActiveSupport::Concern
Defined in:
lib/massive_record/orm/timestamps.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#updated_atObject



35
36
37
# File 'lib/massive_record/orm/timestamps.rb', line 35

def updated_at
  self.class.time_zone_aware_attributes ? self['updated_at'].try(:in_time_zone) : self['updated_at']
end

#updated_at=(time) ⇒ Object



39
40
41
# File 'lib/massive_record/orm/timestamps.rb', line 39

def updated_at=(time)
  write_attribute :updated_at, time
end

#write_attribute(attr_name, value) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/massive_record/orm/timestamps.rb', line 43

def write_attribute(attr_name, value)
  attr_name = attr_name.to_s

  if attr_name == 'updated_at' || (attr_name == 'created_at' && has_created_at?)
    raise MassiveRecord::ORM::CantBeManuallyAssigned.new("#{attr_name} can't be manually assigned.")
  end

  super
end