Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] select helpers with boolean attributes

#6256

While upgrading to rails 3.0.3, I ran into the following problem:

    # blog.rb
    class Blog < ActiveRecord::Base
      # allow_comments :boolean(1) default(FALSE)
      # ...
    end
    
    # view inside a form_for(@blog)
    <%= f.select :allow_comments, [["On", true], ["Off", false]] %>

If allow_comments was true, "On" would be selected. If allow_comments was false, "Off" would NOT be selected. I've fixed this in the attached patch.

Reported by John Allison · January 5th, 2011 @ 07:39 PM

State: committed
Milestone: 3.1
Assigned to: nobody
Importance: Low

Activity

  1. John Allison
    John Allison

    Sorry, it's not allowing me up upload the patch file.

    I've initiated a pull request on github: https://github.com/rails/rails/pull/153

    January 5th, 2011 @ 07:44 PM

  2. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.1
    • State changed from new to committed
    • Importance changed from to Low

    January 9th, 2011 @ 11:51 PM