Rails devise after clicking confirmation link user logged in -


i want when user click confirmation link after user should logged in , redirect specific path. don't have idea.how can this?

now i'm click account confimation , redirect sign in page want logged in , redirect root page

this confirmation_instructions.html.erb

 <p>welcome <%= @email %>!</p>   <p>you can confirm account email through link below:</p>   <p><%= link_to 'confirm account', confirmation_url(@resource, confirmation_token: @token) %></p> 

this user.rb

class user < activerecord::base   has_paper_trail   acts_as_messageable  rolify  # include default devise modules. others available are:  # :confirmable, :lockable, :timeoutable , :omniauthable  devise :database_authenticatable, :registerable, :confirmable,  :recoverable, :rememberable, :trackable, :validatable   has_one :day_care  has_many :actvities, dependent: :destroy   has_one :director, dependent: :destroy  has_one :assistant_director, dependent: :destroy  has_one :teacher, dependent: :destroy  accepts_nested_attributes_for :day_care  accepts_nested_attributes_for :director  accepts_nested_attributes_for :assistant_director  accepts_nested_attributes_for :teacher   def confirm!   super   if confirmed_at_changed? , confirmed_at_was.nil?     usermailer.welcome_email(self).deliver if self.confirmed_at_changed?   end end    #def send_welcome_email  # usermailer.welcome_email(self).deliver if self.confirmed_at_changed? #end  def mailboxer_email   "#{self.email}" end   def name    name = ""    if self.has_role? "director"      name = self.director.name    elsif self.has_role? "assistant_director"      name = self.assistant_director.name    elsif self.has_role? "teacher"      name = self.teacher.name    end    name  end end 

thanks ur help!

in controller, whichever action want make happen

@user = user.find(params[:id]) sign_in(:user, @user) redirect_to some_path 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -