I have to models User
and Blog
. Their respective urls are:
test.com/u/user_name # User
test.com/blogs # Blog
I'm trying to achieve that the blogs are nested to the user which created it. E.g. test.com/u/user_name/blogs
and for an article test.com/u/user_name/blogs/article_name
.
But the index for all blogs should respond to: test.com/blogs
.
right now my routes are like this:
resources :users do
resources :blogs, except: [:index]
end
resources :blogs, only: [:index]
Which doesn't work.. What am i missing?