Rails: Nested resources conflict, how to scope the index action depending on the called route
问题 Imagine you have two defined routes: map.resources articles map.resources categories, :has_many => :articles both accessible by helpers/paths articles_path # /articles category_articles_path(1) # /category/1/articles if you visit /articles , index action from ArticlesController is executed. if you visit /category/1/articles , index action from ArticlesController is executed too. So, what is the best approach for conditionally selecting only the scoped articles depending on the calling route?