Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/enumerated_attribute/integrations/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def write_enumerated_attribute(name, val)
return write_attribute(name, val) unless self.class.has_enumerated_attribute?(name)
val = nil if val == ''
val_str = val.to_s if val
val_sym = val.to_sym if val
val_sym = val.to_s.to_sym if val
return instance_variable_set('@'+name, val_sym) unless self.has_attribute?(name)
write_attribute(name, val_str)
val_sym
Expand All @@ -39,7 +39,7 @@ def read_enumerated_attribute(name)
return instance_variable_get('@'+name) unless self.has_attribute?(name)
#this is an enumerated active record attribute
val = read_attribute(name)
val = val.to_sym if !!val
val = val.to_s.to_sym if !!val
val
end

Expand All @@ -57,7 +57,7 @@ def attributes
atts = super
atts.each do |k,v|
if self.class.has_enumerated_attribute?(k)
atts[k] = v.to_sym if v
atts[k] = v.to_s.to_sym if v
end
end
atts
Expand Down