设计sign_in页面不会在rails 4.2.1中以单独的布局呈现

时间:2015-07-21 07:14:11

标签: ruby-on-rails-4 layout devise action

我想要设计行动的单独布局。

我在我的应用程序控制器中使用以下代码。

class ApplicationController < ActionController::Base

  protect_from_forgery with: :exception
  before_action :configure_permitted_parameters, if: :devise_controller?
  layout :layout_by_resource

  def after_sign_in_path_for(resource)
  stored_location_for(resource) ||
    if resource.is_a?(User) 
      new_applicant_response_url

    else
      homepage_admin_page_path

    end
end

  protected

  def layout_by_resource
    if devise_controller?
      "layout_name_for_devise"
    else
      "application"
    end
  end

  protected
        def configure_permitted_parameters
            devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:assessment_id, :name, :email, :password, :password_confirmation, :remember_me) }
            devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :email, :password, :remember_me) }
            devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password) }
        end

end

我生成了设计视图,并在设计页面中添加了一些样式。

当我点击设计/签名时,我在终端

中输入了以下输出
Started GET "/admins/sign_in" for 127.0.0.1 at 2015-07-24 12:39:49 +0530
Processing by Devise::SessionsController#new as HTML
  Rendered devise/shared/_links.html.erb (0.9ms)
  Rendered devise/sessions/new.html.erb within layouts/layout_name_for_devise (6.9ms)
Completed 200 OK in 21ms (Views: 8.4ms | ActiveRecord: 1.0ms)

我正确地为这个设计签名制作布局。但是在布局设计中,sign_in表单不呈现,只有布局呈现。

1 个答案:

答案 0 :(得分:1)

您的布局可能不会在其中调用yield