Skip to content

Commit

Permalink
make example(added in [d885ac]) green just as a proof of concept.
Browse files Browse the repository at this point in the history
- I thik there will be better way(but I have no idea).
  • Loading branch information
kakutani committed Jan 30, 2012
1 parent d885ac0 commit 942087b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/enumerated_attribute/integrations/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ def validate_enumerated_attribute

def write_enumerated_attribute(name, val)
name = name.to_s
return write_attribute(name, val) unless self.class.has_enumerated_attribute?(name)
unless self.class.has_enumerated_attribute?(name)
if column_for_attribute(name) || attributes.has_key?(name)
return write_attribute(name, val)
else
return
end
end
val = nil if val == ''
val_str = val.to_s if val
val_sym = val.to_sym if val
Expand Down

0 comments on commit 942087b

Please sign in to comment.