title: How to update attributes on database using Ruby on Rails 2.3.9
body: <p>I'm working on a controller action and, what I want to do is to modify a record in the data base.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>def save_reserve
      @pnr = Pnr.find_by_email(params[:pnr][:email])
      if (!@pnr.blank?)
        @pnr.update_attributes(params[:pnr])
      else
        @pnr = Pnr.new(params[:pnr])
        if @pnr.save
          ...
        else
          ...
        end
      end
    end
  </code></pre>
  
  <p>Why <code>@pnr.update_attributes(params[:pnr])</code> doesn't work?</p>
  
  <p>However, if I do:</p>
  
  <pre><code>      @pnr.update_attribute(:name, params[:pnr][:name])
        @pnr.update_attribute(:lastname, params[:pnr][:lastname])
        @pnr.update_attribute(:phone, params[:pnr][:phone])
        @pnr.update_attribute(:addr, params[:pnr][:addr])
  </code></pre>
  
  <p>it works... Am I missing something?</p>
  
  <p>Thank you!</p>