But I want after user successful login, set root_path to others.
FYI : i'm using Devise.
--
Posted via http://www.ruby-forum.com/.
> You could just have your welcome#index action redirect to another
> controller/action if the user is signed in.
That will work nicely for most purposes, but also means that logged-in
users can't access the regular root page. Just have to be careful not
to have anything they might need, *only* on there.
-Dave
--
Dave Aronson, President, Dave Aronson Software Engineering & Training
Ruby on Rails (and others languages) Freelancer (NoVa, DC, or Remote)
On the web: www.DaveAronson.com, www.Codosaur.us, and www.Dare2XL.com
Specialization is for insects. (Heinlein) Have Pun, Will Babble! (me)
It may work better the other way around, make the default root be the
page for logged in user and redirect to welcome page if not logged in.
Colin
I get it. but find difficult to implement it.
could you guy teach me how to write the function ?
I'm new to ror.
Thanks.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
root :to => welcome#index
class ApplicationController < ActionController::Base
before_filter :authenticate_user!, :except[:index, :show]
end
In my welcome controller index
def index
if user_signed_in?
redirect_to projects_url
end
end
I would like to do like colin explained.
root :to => project#index
but how to show the welcome#index as root if user not signed in ?
Gautam Pai,Thank for reply. :)
Using ur explaination.. when user not signed in.
localhost:3000 it will go to login page.
I want it go welcome#index before user choose to login.
Correct me, if I misunderstand ur explanation.
Thiagocifani, Thanks for helping me figure out to solve my problem.
I tried.
after_sign_in_path - redirect to a path after user success signed in.
after_sign_out_path_for - redirect to a path after user signed out.
I want
Before user login, request localhost:3000.
it will bring user to welcome#index.
On welcome#index has a link go to sign in path.
After user success login. localhost:3000.
will bring user to projects#index and
during time user still signed_in, she/he can't access to welcome#index.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Before u login
www.facebook.com, u see the welcome page.
After u login
www.facebook.com, u see the page where all friends sharing stuffs.
> what i want to do is like u go to facebook.
> Before u login
> www.facebook.com, u see the welcome page.
> After u login
> www.facebook.com, u see the page where all friends sharing stuffs.
But they're using the same URL both times. It's not a redirect, or
changing the root path, but different content. You can do pretty much
anything you want based on whether the user is logged in. It seems
rather hackish, but you could have your controller send an entirely
different set of vars and have the view use an entirely different
section. You could at least keep it somewhat clean by separating the
two views into partials or some such....
-Dave
--
Dave Aronson, President, Dave Aronson Software Engineering and Training
Ruby on Rails Freelancing (Northern Virginia, Washington DC, or Remote)
DaveAronson.com, Codosaur.us, Dare2XL.com, & RecruitingRants.com (NEW!)
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (me)