I have a User model and Posts model. I want to display the posts belonging to each user,
via a URL say http://localhost:3000/my_posts/1" but Rails is reporting error saying
that no matching route exits for
http://localhost:3000/my_posts/1.
Rails looks at the complete url : "http://localhost:3000/my_posts/1" as a route , but my
intend is like "http://localhost:3000/my_posts/" should be taken as url route and '1' should be taken has the params:id in this case it represents the User_id.
I have the route match
"/my_posts" => "user#view_posts".
The action routine view_posts of user is working fine when triggered through
"http://localhost:3000/users/1"
here in takes 1 as params id and /user as route.
And also i'm able to display that particular user's posts in the "/user" route by
rendering the partial
<% render 'view_posts %>
I'm Using Rails version 3.