jeffp / enumerated_attribute

Easy enum for your models, objects and views
MIT License
190 stars 64 forks source link

Postgres doesn't seem to correctly save values #41

Closed jpwynn closed 12 years ago

jpwynn commented 12 years ago

After re-doing migrations to use :string instead of :enum, migrations now succeed for postgres (I used Heroku) per another issue reported... but a postgres issue remains.

On that platform when you submit a form containing f.enum_select after choosing a non-default value, it does not get saved to the database. The default value is the one that gets saved.

In my class I have:

    enum_attr :state_owner_submit, %w(^submit_none submit_standard submit_premium)

In my form I have:

    = f.label :state_owner_submit, :class => :label
    = f.enum_select :state_owner_submit

No matter which enumerated attribute I select in the selection box, "submit_none" is what gets saved.

It works fine under sqlite.

jpwynn commented 12 years ago

when changed to :string in my migration it;s fine. Maybe document that -- in fact, is there any reason to use :enum in migrations at all?

jpwynn commented 12 years ago

closing due to workaround