我试图给 Devise 提供的 User 模型添加一个 name 属性。我在数据库中添加了一个 "name" 列,并更改了注册视图,以便询问用户的姓名:
<h2>Sign up</h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<p><%= f.label :name %><br />
<%= f.text_field :name %></p>
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
<p><%= f.label :password %><br />
<%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></p>
<p><%= f.submit "Sign up" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
我可以登录,但是在登录后检查数据库时,name: nil
。我需要在Devise的User
控制器中添加一些东西吗?谢谢!