title: Devise: Ability to pass parameters to the registrations#sign_up action
body: <p>Once in a while we send customized registration links to our leads. The link contains parameters than can be used to pre-fill the registration form.</p>
  
  <pre><code>http://www.example.com/users/sign_up?user[company_name]=Foo&amp;user[region]=NA
  </code></pre>
  
  <p>Our registration form has fields for accepting company name and region. Which can be pre-filled based on the registration link.</p>
  
  <p>This should work in practice, but it doesn't due to how the <code>registrations#new</code> action is implemented. The <a href="https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb#L6" rel="nofollow">new</a> action calls the  <code>build_resource</code> method with an empty hash.</p>
  
  <pre><code>def new
    resource = build_resource({})
    respond_with resource
  end
  </code></pre>
  
  <p>The <a href="https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb#L85" rel="nofollow">build_resource</a> method ignores the <code>resource_params</code> when the input is non nil.</p>
  
  <pre><code>def build_resource(hash=nil)
    hash ||= resource_params || {}
    self.resource = resource_class.new_with_session(hash, session)
  end  
  </code></pre>
  
  <p>I had to over-ride the the <code>new</code> action in my registrations controller to overcome this issue. I don't like my solution as it is brittle.</p>
  
  <pre><code>def new
    resource = build_resource
    respond_with resource
  end
  </code></pre>
  
  <p>Is there a reason why the <code>new</code> action is invoked with an empty hash? Can it be invoked with out empty hash(like in the <code>create</code> action)?</p>