title: Create object from form params and attribute Rails
body: <p>Anyone know how I can write the following as one line?</p>
  
  <pre><code>   email = params[:user][:email]
     @user = User.new(:email =&gt; email, :password =&gt; generate_random_string)
  </code></pre>
  
  <p>I would like  to write it as</p>
  
  <pre><code>@user = User.new(params[:user]. :password =&gt; generate_random_string)
  </code></pre>