The problem is i want to have both nested resources and normal resources pointing the the same action in controller but act differently based on whether the nesting resource in available or not.
Routes.rb
resources :users do
resources :comments //For having nested routes
end
resources :comments //For having normal routes
Nested Resource
For example
Class CommentsController < ApplicationController
def index
@user = User.find(params[:id])
@comment = @user.comments.find(params[:id])
end
Now,
If i want to just look up all the comments , i want to use the
/comments
Else if i am in the user page and click on the all comments i get to
/user/:user_id/comments
Hence, how to configure to make sure it generates the right page.