Radio_button with boolean fields does not work with postgres

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs