title: Rails - updating a boolean value through a controller
body: <p>UPDATE: Controller code at the bottom of this question resolves the issue.
  I'm struggling to update a boolean confirmed_flag field in rails 3. Background: users can host events and can attend events through the attendances model (HATM).
  I have a form_for helper which uses radio buttons to allow a guest to be accepted or declined from an event:</p>
  
  <pre><code>&lt;%= form_for(@attendance) do |f| %&gt;
  &lt;%= render 'shared/error_messages', :object =&gt; f.object %&gt;
    &lt;div class="field"&gt;
    &lt;strong&gt;Event description: &lt;/strong&gt;&lt;%= @attendance.event.description %&gt;&lt;br/&gt;
  &lt;%= f.radio_button :confirmed_flag, 1 %&gt;Accept
  &lt;%= f.radio_button :confirmed_flag, 0 %&gt;Decline
  </code></pre>
  
  <p>This displays fine and hooks into the following controller update action:</p>
  
  <pre><code>def update
    @attendance = Attendance.find(params[:id]) 
    respond_to do |format|
      if @attendance.update_attributes(params[:attendance][:confirmed_flag])
        format.html { redirect_to(@attendance,
                      :notice =&gt; 'Attendance was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action =&gt; "edit" }
        format.xml  { render :xml =&gt; @attendance.errors,
                      :status =&gt; :unprocessable_entity }
      end
    end
  end
  </code></pre>
  
  <p>As you can see, i want the results from the form_for to update the confirmed_flag, but when i look at the values in the rails console for a particular attendance i have updated to 'Accept' in the form, the value of confirmed_flag remains nil.</p>
  
  <p>Any help greatly appreciated.</p>
  
  <p>Edit: relevant server log snippet attached:</p>
  
  <pre><code>Started POST "/attendances/10" for 127.0.0.1 at 2011-03-21 23:42:18 +0000
    Processing by AttendancesController#update as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"Oz5qO/bcEJGmzIEH0xDOvtv7ecbF4wXXHpUtlIkDnfc=", "attendance"=&gt;{"confirmed_flag"=&gt;"1"}, "commit"=&gt;"Update", "id"=&gt;"10"}
    [1m[36mAttendance Load (15.6ms)[0m  [1mSELECT "attendances".* FROM "attendances" WHERE "attendances"."id" = 10 LIMIT 1[0m
  Redirected to http://127.0.0.1:3000/attendances/10
  Completed 302 Found in 109ms
  </code></pre>
  
  <p>Update: The following code in the controller works perfectly. Thanks everybody for your help as always.</p>
  
  <pre><code>def update
          @attendance = Attendance.find(params[:id]) 
          respond_to do |format|
      if 
          @attendance.update_attributes({:confirmed_flag =&gt; params[:attendance][:confirmed_flag]})
          format.html { redirect_to(@attendance,
                      :notice =&gt; 'Attendance was successfully updated.') }
          format.xml  { head :ok }
      else
          format.html { render :action =&gt; "edit" }
          format.xml  { render :xml =&gt; @attendance.errors,
                      :status =&gt; :unprocessable_entity }
              end
          end
      end
  </code></pre>