【发布时间】:2017-01-18 05:47:17
【问题描述】:
我一直在尝试做 SEO 友好的 url,并设法让它工作,但是当我在博客上调用 index 操作时,我得到一个奇怪的“nil:NilClass 的未定义方法 `parameterize'”。该方法在使用 show 方法时有效。
#model
def to_s
title
end
def to_param
"#{id}-#{to_s.parameterize}"
end
#controller
@blogs = Blog.find.all
错误截图 http://www.freeimagehosting.net/image.php?83e76a260b.png
【问题讨论】:
标签: ruby-on-rails