Rails: How do I route unassociated resources?
问题 I have four models: class User < ActiveRecord::Base has_many :posts end class Category < ActiveRecord::Base has_many :posts end class Post < ActiveRecord::Base belongs_to :user belongs_to :metric has_many :comments end class Comments < ActiveRecord::Base belongs_to :post end I'd like to be able to access a post within a certain category for a specific user. For example: http://domain.com/users/1/categories/1/posts Also I want to see a list of all categories if I visit: http://domain.com/users