簡體   English   中英

在將Rails 2.0.2遷移到2.3.5后,Image_tag不起作用

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM