Hello,
Currently I have
config/routes.rb:
map.resources :tags do |tags| tags.resources :articles, :name_prefix => 'tag_' end
with tag_articles_path(tag_name) it maps like I want to:
/tags/blah/articles
… but if I have a tag selected. If I do, for example,
tag_articles_path(:order => ‘top’) and at this moment tag_id is nil, I
get this error:
tag_articles_url failed to generate from {:action=>“index”,
:controller=>“articles”} - you may have ambiguous routes, or you may
need to supply additional parameters for this route. content_url has
the following required parameters: [“tags”, :tag_id, “articles”] - are
they all satisifed?
I think, this is right… But what should I do if I need to use all this
tag_new_article_path, tag_articles_path(:order => ‘top’), etc ?
I know, I can write all helper methods I need or do something like
current_tag ? tag_articles_path : articles_path
or
articles_path(:tag => current_tag), articles_path(:tag => current_tag,
:order …) - in this case I do not know how to get good looking urls
(/tag/tag_name/articles)
maybe there are a better way to handle this ?
Thank you.