我有以下的标记部分插入文本的link_to Rails中
%span.tag-label
= link_to "#{tag}" , :controller => "searches", :action => "search_tags", :search_type => search_type,
:tag_type => tag_type, :tag =>"#{tag}"
和我通过标记部分为集合:
= render "shared/tag_item", :collection => @listing.keyword_list, :as => :tag,
:search_type => "Listing", :tag_type => nil
出于某种原因,我得到这个错误:
wrong number of arguments (0 for 1)
在我的部分。
如果我只是把纯文本放在link_to "text"
和tag =>"text"
那么它就可以工作。 为什么我的嵌入文本"#{tag}"
在这种情况下不起作用?
谢谢。 更新显示错误跟踪: `endered列表/布局内show.html.haml /应用(148.4ms) 完成500内部服务器错误在232ms
ActionView::Template::Error (wrong number of arguments (0 for 1)):
1: %span.tag-label
2: = link_to "#{tag.to_s}" , :controller => "searches", :action => "search_tags", :search_type => search_type,
3: :tag_type => tag_type, :tag =>"#{tag.to_s}"
<a href="txmt://open?url=file:///Users/app/views/shared/_tag_item.html.haml&line=2&column=1">app/views/shared/_tag_item.html.haml
显示错误发生位置的错误跟踪。 – Zabba 2012-04-08 02:28:33
确保'link_to“#{tag}”,''实际上'link_to“#{tag}”,' – 2012-04-08 02:47:46
如果您只输出'url_for(:controller =>“searching”,:action =>“search_tags”,: search_type => search_type, :tag_type => tag_type,:tag =>“#{tag}”)'而不是'link_to..'按预期输出吗? – 2012-04-08 03:38:11