我正在使用自定义视图运行设计,我的login
页面之前完美渲染,但我只是将模型名称从human
更改为user
,重命名为控制器和观点,但它只是拒绝提出我的观点。
我没有收到错误,我的布局完美呈现,但由于某种原因它不会产生正文。
代码
以下是routes.rb
的{{1}}:
Users
这是由设计生成的 ## devise controllers for users
devise_for :user, controllers: {
confirmations: 'user/confirmations',
passwords: 'user/passwords',
registrations: 'user/registrations',
sessions: 'user/sessions',
unlocks: 'user/unlocks',
# commenting the below because omniauth gem isn't installed
# omniauth_callbacks: 'user/omniauth_callbacks'
}, skip: [:sessions]
## custom routes for users
as :user do
get 'login' => 'user/sessions#new', :as => :new_user_session
post 'login' => 'user/sessions#create', :as => :user_session
delete 'logout' => 'user/sessions#destroy', :as => :destroy_user_session
get 'register' => 'user/registrations#new', as: :register
end
:
sessions_controller
以下是我的观点:
class User::SessionsController < Devise::SessionsController
...
# GET /resource/sign_in
def new
super
end
...
end
日志
<%= render layout: 'layouts/shared/left_logo_panel' do %>
<%= form_for(resource, html: {class: 'form'}, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field form-group">
<%= f.label :email %><br />
<%= f.email_field :email, class:'form-control', autofocus: true %>
</div>
<div class="field form-group">
<%= f.label :password %><br />
<%= f.password_field :password, class:'form-control', autocomplete: "off" %>
</div>
<% if devise_mapping.rememberable? -%>
<div class="field form-group">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end -%>
<div class="actions">
<%= f.submit "Log in", class:'btn btn-default' %>
</div>
<% end %>
<%= render "devise/shared/links" %>
<% end %>
答案 0 :(得分:0)
在我的布局中,我将yield
与yield :body
交换,忘记了。好的,我是个傻瓜。检查你的布局,伙计们!