0
我,在我的微型模型视图页面下面的代码传递PARAMS
<%= content_setmini_links_with_quantity(@miniature) %>
它指的是这个miniatures_helper方法
def content_setmini_links_with_quantity(miniature)
miniature.reverse_contents.map{|content| content_setmini_link_with_quantity(content)}.join(' ').html_safe
end
这反过来又引用这miniatures_helper方法
def content_setmini_link_with_quantity(content)
string = (tag "td"), (link_to top_pic(content.setmini_id), content.setmini), (link_to content.setmini.name, content.setmini)
string << " x#{content.quantity}" if content.quantity.present?
return string
end
这应该引用最后的miniatures_helper方法
def top_pic
@miniature = Miniature.find(params[:setmini_id])
if @miniature.collections.first.photo != nil
image_tag(@miniature.collections.first.photo.url(:icon), :retina => true, :class => "curvediconminiset")
else
image_tag("https://system/stock/blank.gif", :retina => true, :class => "curvediconminiset")
end
end
但我不知道如何正确调用top_pic。
据我所知content_setmini_link_with_quantity(content)
唯一可用的参数是内容。 Content.setmini_id
是我想用来查找要显示的@miniature
的参数,但我无法使其工作。
任何帮助非常感谢。
啊我明白了。在帮助程序中,每个方法都有一个定义的参数,您不能使用参数。谢谢。我现在得到“未定义的方法'照片为零:NilClass”错误,但我认为这是另一个问题,你已经回答了这个问题。今天在这个每一个阶段都陷入困境。 – Ossie