lib/greenwich/conversion.rb in greenwich-2.0.1 vs lib/greenwich/conversion.rb in greenwich-2.0.2
- old
+ new
@@ -18,11 +18,11 @@
super(value)
end
define_method time_field do
time_zone = Greenwich::Utilities.get_time_zone(self, time_zone_field)
- time = read_attribute(utc_time_field)
+ time = send(utc_time_field)
time = time.in_time_zone(time_zone) if time && time_zone
time
end
@@ -58,11 +58,11 @@
time_zone = Greenwich::Utilities.coerce_to_time_zone_name(value)
write_attribute(name, time_zone)
associated_time_fields.each do |time_field|
if greenwich_time_field_needs_conversion?(time_field, name)
- send("#{time_field}=".to_sym, read_attribute("#{time_field}_utc"))
+ send("#{time_field}=".to_sym, send("#{time_field}_utc"))
greenwich_time_fields_converted["#{time_field}_utc"] = true
end
end
end
@@ -78,10 +78,10 @@
end
private
def greenwich_time_field_needs_conversion?(time_field, time_zone_field)
(send("#{time_zone_field}_was".to_sym).nil? || send("#{time_field}_utc_was").nil?) &&
- read_attribute("#{time_field}_utc").present? &&
+ send("#{time_field}_utc").present? &&
self.greenwich_time_fields_converted["#{time_field}_utc"].nil?
end
end
end