ruby - Rails link_to with acts_as_taggable_on_steroids -
i using acts_as_taggable_on steroids , having problem piece of code generates link tag:
<%= link_to tag, tag_path(:id => tag.name) %>
when access url:
http://localhost:3000/tags/rails
i error:
no action responded rails. actions: show
however, url works:
http://localhost:3000/tags/show/rails
i have defined show action in tags_controller.rb
class tagscontroller < applicationcontroller def show @stories = story.find_tagged_with(params[:id]) end end
i have following routes generated rake:routes :
tags /tags(.:format) {:controller=>"tags", :action=>"index"} post /tags(.:format) {:controller=>"tags", :action=>"create"} new_tag /tags/new(.:format) {:controller=>"tags", :action=>"new"} edit_tag /tags/:id/edit(.:format) {:controller=>"tags", :action=>"edit"} tag /tags/:id(.:format) {:controller=>"tags", :action=>"show"} put /tags/:id(.:format) {:controller=>"tags", :action=>"update"} delete /tags/:id(.:format) {:controller=>"tags", :action=>"destroy"}
so know url tags/rails points route tags/:id, , i've provided additional param link_to assign tag name :id param, can see, it's not working. forum suggested use to_param have not tag model , book suggested against it. missing anything?
i following sitepoint book rails 2
edit: added working url, see top
try adding route resource:
:requirements => { :id => /.*/ }
Comments
Post a Comment