after_confirmation_path_for override not working?

1,298 views
Skip to first unread message

aross

unread,
Aug 19, 2011, 1:32:18 PM8/19/11
to Devise
I'm trying to redirect a confirmed user to a welcome page. I overrode
after_confirmation_path_for with the following:

class ConfirmationsController < Devise::ConfirmationsController
protected

# The path used after confirmation.
def after_confirmation_path_for(resource_name, resource)
welcome_users_path
end
end


But it didn't work (it followed the same redirect pattern as before).
However, if I override the entire "show" action, it works:

class ConfirmationsController < Devise::ConfirmationsController
def show
self.resource =
resource_class.confirm_by_token(params[:confirmation_token])

if resource.errors.empty?
set_flash_message(:notice, :confirmed) if
is_navigational_format?
sign_in(resource_name, resource)
respond_with_navigational(resource){ redirect_to
welcome_users_path }
else
respond_with_navigational(resource.errors, :status
=> :unprocessable_entity){ render_with_scope :new }
end
end
end

Any idea what's going on here? I would prefer to just override the
path method and leave the show action intact...

Thanks,
Andy

mopx

unread,
Sep 18, 2011, 12:25:41 AM9/18/11
to Devise
I was having the same problem, and I figured it out, you need to add
the override to your routes too

devise_for :users, :controllers => { :confirmations =>
"confirmations" }

On Aug 19, 12:32 pm, aross <arossexperie...@gmail.com> wrote:
> I'm trying to redirect a confirmed user to a welcome page.  I overrodeafter_confirmation_path_forwith the following:
>
> class ConfirmationsController < Devise::ConfirmationsController
>   protected
>
>    # The path used after confirmation.
>   defafter_confirmation_path_for(resource_name, resource)

José Valim

unread,
Sep 18, 2011, 1:36:49 AM9/18/11
to Devise
Also be sure you are using a version that support
after_confirmation_path
Reply all
Reply to author
Forward
0 new messages