Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

read_enumerated_attribute fix for integer-based activerecord fields #48

Open
wants to merge 2 commits into from

1 participant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/enumerated_attribute/integrations/active_record.rb
View
6 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
Something went wrong with that request. Please try again.