I want to implement account scoping in my application like in twitter
www.twitter.com/tispratik/events/1
meaning whatever am browsing in twitter, the route should contain
www.twitter.com/tispratik always.
or other users it should be www.twitter.com/user1 or www.twitter.com/user2
and so on...
Any ideas on how to write the routes.rb for this and how to use these
routes in controllers or views.
Thanks,
Pratik
so that i can do the necessary scoping while loading www.twitter.com/tispratik/events
worked for me. Once the user logs in, i find out the account info and
store it in the session.
Route i used: redirect_to user_path("tispratik",
@user_session.user.id)
which generated http://localhost:3000/tispratik/users/1
I could retrieve it as: logger.info("ACCOUNT: " + params
[:account].to_s)
Now how do i make sure that i dont have to put the account object
everytime i write a route?
meaning: Instead of writing, redirect_to user_path("tispratik",
@user_session.user.id)
i should write edirect_to user_path
(@user_session.user.id) without caring for the account each time, it
should be automatically added as a part of the route.
Thanks,
Pratik