sign_in使用日期(例如:生日)和gem'devise'track4

时间:2016-02-27 13:03:25

标签: ruby-on-rails ruby devise

用户将使用设计宝石使用日期(例如:生日)登录。我试过这个:

user.rb 档案:

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :authentication_keys => [:account, :birthday]

  def email_required?
    false
  end
end

users/sessions/new.html.erb档案:

   <%= f.date_select :birthday,  order: [:month, :day, :year]  %>

application_controller.rb档案:

    class ApplicationController < ActionController::Base
      protect_from_forgery with: :exception
      before_filter :configure_permitted_parameters, if: :devise_controller?
      protected
      def configure_permitted_parameters
        devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:birthday, :account, :email, :password) }
      end
    end

我做错了什么?

0 个答案:

没有答案