7
all! 也許有人知道爲什麼這樣的:link_to(:controller =>「something」)helper +設計無法正常工作
def index_link(object, content = t("#{object.to_s.pluralize}.index"))
#link_to(content, {:controller=>object.to_s.pluralize}, :scope=>"") if can?(:read, p(object)) #this doesn't work too
link_to(content, :controller=>"trademarks")
#link_to(content, trademarks_path) #this do work, but I need to set path from object
end
使得這樣一個例外:
No route matches {:controller=>"devise/trademarks"}
堆棧:
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:406:in `generate'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:453:in `generate'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:481:in `url_for'
actionpack (3.0.3) lib/action_dispatch/routing/url_for.rb:131:in `url_for'
actionpack (3.0.3) lib/action_view/helpers/url_helper.rb:99:in `url_for'
actionpack (3.0.3) lib/action_view/helpers/url_helper.rb:236:in `link_to'
app/helpers/application_helper.rb:53:in `index_link'
app/views/layouts/application.html.erb:20:in `_app_views_layouts_application_html_erb___741328535__615736668_0'
actionpack (3.0.3) lib/action_view/template.rb:135:in `send'
actionpack (3.0.3) lib/action_view/template.rb:135:in `render'
,以及如何使其工作?
你說的 「我需要從對象設置路徑」 是什麼意思? – Heikki 2011-01-26 11:06:41
你可以從你的控制檯聲明耙路的輸出嗎? – ecoologic 2011-01-26 13:50:06