[英]Image_tag doesn't work after migration rails 2.0.2 to 2.3.5
我想将Rails应用程序2.0.2升级到2.3.5。 在mysql出现许多问题之后,我的应用程序又遇到了另一个大问题。
这是问题所在:
Processing UserController#profil (for 127.0.0.1 at 2009-12-26 11:47:13) [GET]
Rendering template within layouts/admin
Rendering user/profil
ActionView::TemplateError (undefined method `image_tag' for #<ActionView::Base:0x1032bef18>) on line #57 of app/views/user/profil.html.erb:
54: <div style="float: left; width: 300px;" >
55: <%= render :partial => 'shared/cadre', :locals => {:style => '', :modif => modif,
56: :title => 'AVATAR', :width => 200,
57: :display => image_tag(@userView.GetAvatar, :class => 'ie200', :style => 'max-height: 200px; max-width: 200px;') } -%>
58: <div style="position: relative;" >
59: <div class="menu-profil" >
60: <select id="menuProfil" name="my-dropdown" >
app/views/user/profil.html.erb:57
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
Rails不知道image_tag方法,但是为什么呢?
我没有发现问题。
你能帮我吗 :)
非常感谢。
与其在本地@userView
中传递image_tag
的结果,不如尝试将@userView
作为本地@userView
传递,然后在shared/cadre
使用该本地变量来呈现图像标签:
<%= render :partial => 'shared/cadre', :locals => {:style => '', :modif => modif, :title => 'AVATAR', :width => 200, :userView => @userView } -%>
更换您的
<%= display %>
在与
<%= image_tag(userView.GetAvatar, :class => 'ie200', :style => 'max-height: 200px; max-width: 200px;') %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.