如何覆盖设计控制器

时间:2016-08-24 12:15:49

标签: ruby-on-rails ruby devise rubygems

我试图覆盖设计控制器,但我的更改没有任何影响。

这是我的sessions_controller.rb例如

class Users::SessionsController < Devise::SessionsController
  # before_action :configure_sign_in_params, only: [:create]

  # GET /resource/sign_in
   def new
     super
     authorize! :new, @user
   end

  # POST /resource/sign_in
   def create
     super
     authorize! :create, @user
   end

  # DELETE /resource/sign_out
  # def destroy
  #   super
  # end

  # protected

  # If you have extra params to permit, append them to the sanitizer.
  # def configure_sign_in_params
  #   devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
  # end
end

这应该采用“正常”会话控制器的def new并添加第二行。

github

上原始session_controller的链接

这是我的routes.rb

    Rails.application.routes.draw do
  resources :sessions
  resources :corsin_lists
  resources :fileuploads do
    collection { post :import }
  end

  root 'documents#index'
  resources :documents
  resources :entries

  resources :documents do
    member do
      get :entries
    end
  end
  devise_for :users, :controllers => {:sessions => "users_sessions"}
end

0 个答案:

没有答案