Skip to content

Commit

Permalink
Attempted fix for overzealous refactoring.
Browse files Browse the repository at this point in the history
a37c4e1 factored out

    read_attribute(:datetime_value)

to #datetime_value.  Unfortunately, this shadows ActiveRecord's
definition of #datetime_value (which is auto-generated).  Hypothesis:
this is causing things like timezone conversion to be eliminated from
the attribute reader.
  • Loading branch information
Paul Friedman committed Jun 24, 2013
1 parent 6186ed7 commit 33439f6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/surveyor/models/response_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def correct?
end

def time_value
datetime_value.try(:strftime, time_format)
read_attribute(:datetime_value).strftime( time_format ) unless read_attribute(:datetime_value).blank?
end

def time_value=(val)
Expand All @@ -64,7 +64,7 @@ def time_value=(val)
end

def date_value
datetime_value.try(:strftime, date_format)
read_attribute(:datetime_value).strftime( date_format ) unless read_attribute(:datetime_value).blank?
end

def date_value=(val)
Expand All @@ -76,10 +76,6 @@ def date_value=(val)
end
end

def datetime_value
read_attribute(:datetime_value)
end

def time_format
'%H:%M'
end
Expand All @@ -102,7 +98,7 @@ def to_formatted_s
when :time
time_value
when :datetime
datetime_value.try(:strftime, datetime_format) || ''
(read_attribute(:datetime_value).strftime( datetime_format ) unless read_attribute(:datetime_value).blank?) || ''
else
to_s
end
Expand Down

0 comments on commit 33439f6

Please sign in to comment.