nofxx/symbolize — Issue #20: symbolize don't support column default value on database
Author: sunteya
Created: 2011-10-28 04:43:44+00:00
State: open

In 4.0.2, I can use `t.string: state,: default => "scheduled"` or

````ruby
# init default values
def attributes_from_column_definition
super.tap do |result|
result["state"] = "scheduled"
end
end
````
define a default value. And can use the `scheduled?` method after new object.

but, in 4.0.3 the `scheduled?` alway return false. because:

````ruby
# symbolize-4.0.3/lib/symbolize/active_record.rb #90 Line
if methods
values.each do |value|
key = value[0]
define_method("#{key}?") do
self[attr_name] == key
end
end
end
````

`self[attr_name]` return `"scheduled"` and key is `:scheduled`, and change code to

````ruby
self[attr_name].to_s == key.to_s
````
it will work fine.

BTW: I do not like to use symbolize method for: default option

````ruby
symbolize :kind, :in => [:admin, :manager, :user], :default => :user
````
Because only save object, the symbolize can be written the default value.