我目前有这样设置我的设计登录表单。而不是 content_for,我只想将此内容放在部分(命名views/devise/sessions/_new.html.erb
而不是views/devise/sessions/new.html.erb
)中以在布局中呈现。但是当我这样做时,我得到
undefined local variable or method resource for #<#<Class:0x0000010300f6f0>:0x0000010300da30>
<% content_for :header do %>
<div id="login">
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div class="login_header"><%= f.email_field :email, :placeholder => "Email" %></div>
<div class="login_header"><%= f.password_field :password, :placeholder => "Password" %></div>
<% if devise_mapping.rememberable? -%>
<div class="login_header"><%= f.check_box :remember_me %> <%= f.label :Stay_logged_in %></div>
<% end -%>
<div class="login_header"><%= f.submit "Sign in" %></div>
<% end %>
<br /><br />
<%= render :partial => "devise/shared/links" %>
</div>
<% end %>