Skip to main content

acts_as_bitfield Plugin now Radio Button Compatible

Blog post   •   Jan 13, 2010 16:44 GMT

I've patched the acts_as_bitfield plugin to recognize "true" as true so that now instead of having to write:

<%= f.radio_button(:email_activated, true, :checked => ("checked" if @item.email_activated?)) %> Yes

<%= f.radio_button(:email_activated, false, :checked => ("checked" unless @item.email_activated?)) %> No

you can omit the checked argument just like with ActiveRecord boolean attributes:

<%= f.radio_button(:email_activated, true) %> Yes


<%= f.radio_button(:email_activated, false) %> No


Comments (1)

    Hi!

    Thanks for such a knowledgeable post.

    <a href="http://airul.id/cerita-lucu">Airul</a>

    - Market Research Vietnam - May 11, 2016 03:25 GMT

Add comment

Comment