Shane Sherman
2006-Jul-06 13:57 UTC
[Rails] radio_button with boolean fields does not work with postgresql
I don''t know what I am doing wrong. I have a User class with a "send_message_emails" boolean field. The value for this is true. In postgresql this is stored as a "t" in the database. In Rails this field is a boolean and is set to true, but for some reason the following code is *not* working... the radio_button is not selected. <%= radio_button "user", "send_message_emails", ''true'' %> I have tried all of the following combinations and none of them have worked: <%= radio_button "user", "send_message_emails", ''true'' %> <%= radio_button "user", "send_message_emails", ''True'' %> <%= radio_button "user", "send_message_emails", true %> <%= radio_button "user", "send_message_emails", ''1'' %> <%= radio_button "user", "send_message_emails", 1 %> <%= radio_button "user", "send_message_emails", ''t'' %> The radio button is never selected. I''ve printed out @ user.send_message_emails right before the radio_button and the value is definitely boolean true. Has anyone else seen this problem? Any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060706/132d97ca/attachment.html