我在渲染登录页面时遇到问题。我遵循了这个turtorial:http://www.dixis.com/?p=352但在我使用的观点中:
# app/views/user_sessions/new.html.erb
<h1>Login</h1>
<%= form_for @user_session, :as => :user_session, :url => { :action => "create" } do |f| %>
<%= render "shared/error_messages", :target => @user_session %>
<%= f.label :email %><br />
<%= f.text_field :email %><br />
<br />
<%= f.label :password %><br />
<%= f.password_field :password %><br />
<br />
<%= f.check_box :remember_me %><%= f.label :remember_me %><br />
<br />
<%= f.submit "Login" %>
<% end %>
但只有文字“登录”显示。任何人都可以帮助我吗?
答案 0 :(得分:0)
在Rails 3中
您需要更改为
<%= form_for @user_session, :as => :user_session, :url => { :action => "create" } do |f| %>