title: Randomly generated password Rails 3.1
body: <p>For the purpose of a new web app, I would need on my sign up page (which is administrator only) just only one email field.</p>
  
  <p>The thing is that I'm totally new at rails and so even basics things like that are for me really difficult...</p>
  
  <p>I created my authentification using Railscast #270 which uses <strong>has_secure_password</strong> method.
  For now, everything works great except that I dont need all this bullcrap...
  I also want to use Action Mailer to send the generated password to his email adress.
  A hex(8) password would be perfect (I have seen <strong>SecureRandom</strong> but it seems to be depreciated)</p>
  
  <p>Users_Controller:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
    skip_before_filter :is_connected?, :only =&gt; [:new, :create]
  
    def new
      @user = User.new
    end
  
    def create
      @user = User.new(params[:user])
      if @user.save
        # Tell the Mailer to send a welcome Email after save
        Mailer.confirm_email(@user).deliver
  
        redirect_to root_url, :notice =&gt; "Signed up!"
      else
        render "new"
      end
    end
  end
  </code></pre>
  
  <p>User_model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    attr_accessible :email
    has_secure_password
    validates_presence_of :password, :email, :on =&gt; :create
  end
  </code></pre>
  
  <p>For now, in my view, I have 2 fields. But as I said earlier, I only want one.
  I would like to keep using has_secure_password which seems to offer a pretty good security regarding hash/salt.</p>