super is not working on after_sign_in_path_for(resource)

25 views
Skip to first unread message

Cristian Hoyos

unread,
May 13, 2014, 5:49:10 PM5/13/14
to rubyonra...@googlegroups.com
I have this:

class Users::SessionsController < Devise::SessionsController

def after_sign_in_path_for(resource)
 super
end

super redirect to root_path and i dont want to do it. I need to redirect other view
 

Tarun Garg

unread,
May 15, 2014, 8:26:56 AM5/15/14
to rubyonra...@googlegroups.com
I think copy the code from devise is better way to redirect to the page
where ever you want.

--
Posted via http://www.ruby-forum.com/.

Antônio Augusto Sousa Britto

unread,
May 15, 2014, 10:55:37 AM5/15/14
to rubyonra...@googlegroups.com
Devise will look for a scoped model "root path" to redirect, and then if it doesn't find one, it will redirect to root page.

So, if your model is "User", u can create something like this in your routes.rb:

  get "begin", to: "services#new", as: "user_root"

This way you can redirect to whichever view you want.



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bd12818c-33ec-4462-81f6-f9a82efe6861%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Att, Antônio Augusto de Sousa Britto - 43ª turma de Ciência da Computação - UFU
Reply all
Reply to author
Forward
0 new messages