I am getting a weird state in my apps routes.
It’s a basic discussion forum I am building with rails. I am using nested resources like:
resources :forums do
resources :discussions
end
and generating a view to display all discussions with the requirement that clicking on any of these discussions should route to the appropriate discussion such as “forum/2/discussions/3”. Yet when I use:
<% Discussion.find_each do |discussion| %>
<%= link_to discussion.title, forum_discussions_path(discussion.forum_id, discussion) %>
<% end %>
the generated url/link is “forums/2/discussion.3” Any ideas why there is a “.” instead of a “/”?
You need to use the
forum_discussionroute, not theforum_discussionsrouteAltogether that looks like
You were pointing it to this route
so the
discussion.idvalue was being used as the:formatoption.