title: How to give option for resend verification email to user?
body: <p>i am working on rails3 application. In my application when a user registered first time, an email has been sent to user with a verification link, after clicking that link i update the status_id and redirect user to login page. Here is my code :</p>
  
  <p>code for token generation:</p>
  
  <pre><code>require 'digest/sha2'
  class Subscription &lt; ActiveRecord::Base
  
  
    validate :ids_must_be_present, :on =&gt; :create 
  
   def ids_must_be_present
      if status_id==0 
        generate_token
      else
        errors.add('Something gone wrong')
      end
    end
  
    def generate_token
      self.token = encrypt_string(id, generate_salt)
    end
  
    def encrypt_string(id, salt)
      Digest::SHA2.hexdigest(id.to_s + "prftnxt" + salt)
    end
  
  
  
    private
  
    def generate_salt
      self.object_id.to_s + rand.to_s + company_id.to_s  + Time.now.to_i.to_s
    end
  end  
  </code></pre>
  
  <p>code to send email with link:</p>
  
  <pre><code>def email_verify
     if subscription = Subscription.find_by_id_and_token(params[:id], params[:token])
        subscription.update_attribute(:status_id, 1)
        redirect_to("/login/index", :notice =&gt; "Thanks, email successfully verified")
     else
       flash.now[:notice] = "Your email has not verified yet. Please verify your email by clicking the link we have sent you."
     end
    end
  </code></pre>
  
  <p>Email template with verification link:</p>
  
  <pre><code>Hello &lt;b&gt;&lt;%= @user.username %&gt;&lt;/b&gt;,
  &lt;br/&gt;
  &lt;br/&gt;
  Thank you for signing up .
  &lt;b&gt; Please Verify your email&lt;/b&gt;
  
      &lt;%= link_to "verify", "http://localhost:3000/login/email_verify?token=#{@subscription.token}&amp;id=#{@subscription.id}"%&gt;
  
  &lt;/br&gt;&lt;/br&gt;
  &lt;/br&gt;
  </code></pre>
  
  <p>Now everything is fine, now my client want if user did not get verification email, then we some where give the option or link to request to resend verification mail.</p>
  
  <p>i am thinking on to display flash msg on login attempt with a link to  request for email.
  but i am confused how do i do this any example or help would be helpful thanks.</p>