In Rails the default path for a post ‘show’ action would be /post/:id.
How do I change it something like /post/:pid?
I have read about overriding the to_param method
def to_param
self.pid
end
That makes passing the pid of the post instance, but it would be available in the action as
params[:id] which is not apt.
What I would like is params[:pid] in any action would give me the pid of the post instance.
Thanks in Advance.
Try to put this in the routes: