Radio buttons show false when clicked

9 views
Skip to first unread message

NN Dodhia

unread,
Mar 7, 2013, 7:27:55 AM3/7/13
to rubyonra...@googlegroups.com
Hi i have this code :
<%= f.input :xyz, :label => "Select a number:",:collection => ["twenty.","forty"],
  :as => :radio%>

where xyz is a boolean field, so when i submit my form and check in the database it shows the selection as false even though i've selected a radio button and there's also a validates presence of

Gautam Pai

unread,
Mar 7, 2013, 8:23:16 AM3/7/13
to rubyonra...@googlegroups.com

What do you get in the params?

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/A10dXRRascwJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

Colin Law

unread,
Mar 7, 2013, 8:36:33 AM3/7/13
to rubyonra...@googlegroups.com
On 7 March 2013 12:27, NN Dodhia <aca1...@sheffield.ac.uk> wrote:
> Hi i have this code :
> <%= f.input :xyz, :label => "Select a number:",:collection =>
> ["twenty.","forty"],
> :as => :radio%>

Can you point to the docs for the use of :as => :radio in that way, I
can't seem to find it.

>
> where xyz is a boolean field, so when i submit my form and check in the
> database it shows the selection as false even though i've selected a radio
> button and there's also a validates presence of

Note that false is a value, so validates presence of will be quite
happy with false. It is not the same as nil.

Colin
Reply all
Reply to author
Forward
0 new messages