title: Rails form_for and text_field without model attribute
body: <p>I'm writing a form for users to register their products with. I already have <code>class User has_many :products</code> and <code>class Product belongs_to :user; attr_accessible :serial_number</code>. So the idea is that the user enters the serial number in the form and I call <code>@user.products &lt;&lt; Product.find_by_serial_number params[:serial_number]</code> or somesuch.</p>
  
  <p>It seemed sensible to add this as a register action to the <code>UsersController</code>:</p>
  
  <pre><code>resources :users do
    member do
      get 'register'
    end
  end
  </code></pre>
  
  <p>And I have the following in <code>register.html.erb</code>:</p>
  
  <pre><code>5:   &lt;%= render 'shared/error_messages' %&gt;
  6: 
  7:   &lt;%= f.label :serial_number, "Serial number" %&gt;
  8:   &lt;%= f.text_field :serial_number %&gt;
  9: 
  10:   &lt;%= f.submit "Register product" %&gt;
  11: &lt;% end %&gt;
  </code></pre>
  
  <p>This throws the error:</p>
  
  <pre><code>undefined method `serial_number' for #&lt;User:0x000000060b1d40&gt;
  extracted source (around line #8):
  ...
  </code></pre>
  
  <p>So...a) How do I stop this error? b) Umm...what's going to happen after the submit button is pressed? I'm assuming it'll call the <code>update</code> action (which is also used by the edit form)...should I make that fatter to deal with both possiblities? Or make a new action? (If so, how do I reroute the form to point to that?) c) Error-handling (putting in an invalid serial number) is best handled in the controller, not the model, right?</p>
  
  <p>Thanks.</p>