2008-03-21
关于Rails2.0下的File-Column插件使用
关键字: rails2.0; file_column
在rails2.0以下版本下开发的时候,参照“整合File-Column和Rmagick功能实现图片上传“http://airport.javaeye.com/blog/33216
就可以实现图片的上传。
但是在rails2.0中,当在show.html.erb实现图片显示:
原始大小:
<%= image_tag url_for_file_column 'entry', 'image' %>
<br>
thumb:
<%= image_tag url_for_file_column 'entry', 'image' ,'thumb'%>
报错提示:
查找了很多地方,没有找到答案。
就可以实现图片的上传。
但是在rails2.0中,当在show.html.erb实现图片显示:
原始大小:
<%= image_tag url_for_file_column 'entry', 'image' %>
<br>
thumb:
<%= image_tag url_for_file_column 'entry', 'image' ,'thumb'%>
报错提示:
Showing groups/show.html.erb where line #2 raised: You have a nil object when you didn't expect it! The error occurred while evaluating nil.relative_url_root Extracted source (around line #2): 1: <div id="group" class="group"> 2: <%= image_tag url_for_file_column 'group', 'ico' %> 3: </div> 4: <div id="gcomments" class="gcomments"> 5:
查找了很多地方,没有找到答案。
评论
distortion
2008-04-14
pure 写道
<%= image_tag url_for_file_column 'group', 'ico' %>
'group'要改成你的实例名,如实例为@user等
<%= image_tag url_for_file_column @user, 'ico' %>
'group'要改成你的实例名,如实例为@user等
<%= image_tag url_for_file_column @user, 'ico' %>
我也遇到了这个问题,
nil.relative_url_root的异常是由file_column_helper中的url_for_file_column方法抛出来的,是因为在url_for_file_column方法中还使用"@request"访问Request,只要删了'@',使用Rails 2.0的request代替@request就可以了
pure
2008-03-24
<%= image_tag url_for_file_column 'group', 'ico' %>
'group'要改成你的实例名,如实例为@user等
<%= image_tag url_for_file_column @user, 'ico' %>
'group'要改成你的实例名,如实例为@user等
<%= image_tag url_for_file_column @user, 'ico' %>
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 1449 次
- 性别:

- 来自: 成都

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
关于Rails2.0下的File-Col ...
pure 写道<%= image_tag url_for_file_col ...
-- by distortion -
关于Rails2.0下的File-Col ...
<%= image_tag url_for_file_column 'gr ...
-- by pure -
升级到Rails2.0 ,出现HT ...
看看log里怎么说。
-- by ashchan -
rails中scaffold自动生成 ...
找到了,修改views的_form.rhtml
-- by kenrome -
rails中scaffold自动生成 ...
kenrome 写道<p><strong>目标:做一个博客系统,有两 ...
-- by 9esuLuciano






评论排行榜