Rails 关于 rails form 的问题

menghuanwd · October 31, 2012 · Last by sandybeauty replied at October 31, 2012 · 2692 hits

<%= form_for(@user) do |f| %> <%= f.label :name%> <%= f.text_field :name %>
<%= f.label :password%> <%= f.password_field :password%>
<%= f.submit "submit" %> <% end %>

报错提示:undefined method `model_name' for NilClass:Class

@user 是不是没有在 controller 里声明?

You need to Sign in before reply, if you don't have an account, please Sign up first.