Hiding URL params


How can I hide params on the URL? If I have the following resources,
how can I hide the groups resources on the URL when showing posts?

map.resources :groups do |groups|
groups.resources :posts

Normally it will be groups/1/posts/1

I want the URL to show only posts/1 and have the group_id and
controller_name invisible.



then don’t nest the resources

map.resources :groups
map.resources :posts

Hi Jemminger,

The thing is that I need that group_id to perform some queries on the


Well, Long Version of the problem:

I know that is impossible unless I have a session or maybe sending an
extra param at the end of the url. The app I am creating is built
around the concept of groups. So a user can belong to various groups
and make posts and events on each of them. They also want the users
profiles to stand-alone on the URL without the group preceding. So a
user profile will show all his/her activity on all the groups. But
then, If I am navigating through a group and click on a user who
created and event I will be taken to he/she’s profile and all the menu
links for group events and posts will be broken because those links
where created with the group_id. So now I there’s no reference to
which group I was navigating. That’s why I asked if maybe I could have
it there but hidden.

if your Post belongs_to a Group, then you can reference by