【发布时间】:2016-12-03 17:43:32
【问题描述】:
我将我的应用程序从 Rails 3.2 迁移到 4.2.6。每当我运行我的应用程序时,都会收到以下警告:
弃用警告:
#column_for_attribute将返回一个空对象 对于 Rails 5 中不存在的列。如果需要,请使用#has_attribute?检查属性是否存在。 (从块调用(2 级) 在 _app_views_sessions_new_html_erb__912345678695999592_96040780 中 /home/myuser/Desktop/myproject/app/views/sessions/new.html.erb:12)
这是它在日志中显示的形式,警告在密码行:
<%= semantic_form_for(resource, :as => resource_name, :url => user_session_path, :remote => true, :format => :json}) do |f| %>
<%= f.inputs do %>
<%= f.input :email, :label => 'Your email address', :input_html => { :placeholder => "Email"} %>
<%= f.input :password, :label => 'Your password', :required => true, :input_html => { :placeholder => "Password"} %>
<% end %>
<%= f.submit_button :label => 'Sign me in', :button_html => {:class => 'login submit button', :id => 'user_submit' }%>
<% end %>
请帮忙。
【问题讨论】:
-
您在使用其他类似设计的东西吗?如果是这样,您可能还需要升级该依赖项。
-
我正在使用 devise 并将其升级到 4.2.0。
-
下一步是检查 Devise 是否有未解决的问题。因为这可能是 Rails 5 的警告。
标签: ruby-on-rails