点击后提示:
与下载的该书源码对比后发现,本节中修改了depot/app/helpers/store_help.rb如下:
CODE:
module StoreHelper
def hidden_div_if(condition, attributes = {})
if condition
attributes["style"] = "display: none"
end
attrs = tag_options(attributes.stringify_keys)
"<div #{attrs}>"
end
end而下载的源码为:CODE:
module StoreHelper
def hidden_div_if(condition, attributes = {}, &block)
if condition
attributes["style"] = "display: none"
end
content_tag("div", attributes, &block) # The different line
end
end使用第二段代码的话就不会出错。。不知道为什么,有人遇到过这个问题嘛?哪位达人帮我解释一下呀,好迷茫。

