如何获得设计库,以便可以像php库一样进行修改

时间:2018-09-06 13:48:57

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-4 devise devise-confirmable

像这样获得生成的devise控制器。

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

  # GET /resource/sign_in
   def new
    # super
        #       byebug
        redirect_to  root_url   
   end

  # POST /resource/sign_in
   def create
        puts 'Login user............'        
        super
        puts '..............'

   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

在哪里可以找到devise的库,以便可以对其进行新功能的修改,而不会出现双重重定向错误。

假定在终端注销中输入为

Users::SessionsController#new as HTML

在其devise库中为new方法编写的代码在哪里。

1 个答案:

答案 0 :(得分:0)

如果我明白你的意思 在设计模型中,您必须做这样的事情

   before_create :welcome_alert
   before_create :confirm_email
   after_save :subscribe_user_to_mailing_list

def welcome_alert
    alert = ("signed_up_but_unconfirmed")
  end

  def confirm_email
    UserMailer.registration_confirmation(self).deliver
  end

这就是您想要的!