今天做一个购物车程序,程序一切正常,采用插件File-Column。但显示图片是老报如下错误:
- You have a nil object when you didn't expect it!
- The error occurred while evaluating nil.relative_url_root
搜了好久答案,最终在一个帖子回复中找到了答案:原文引用如下
“我也遇到了这个问题,
nil.relative_url_root的异常是由file_column_helper中的url_for_file_column方法抛出来的,是因为在url_for_file_column方法中还使用"@request"访问Request,只要删了'@',使用Rails 2.0的request代替@request就可以了 ”
摘自:http://www.iteye.com/topic/174617
感谢善于分享的程序员们~