diff --git a/lib/enumerated_attribute/integrations/active_record.rb b/lib/enumerated_attribute/integrations/active_record.rb index f4daa6d..599854c 100644 --- a/lib/enumerated_attribute/integrations/active_record.rb +++ b/lib/enumerated_attribute/integrations/active_record.rb @@ -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 @@ -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 @@ -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