用户将使用设计宝石使用日期(例如:生日)登录。我试过这个:
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
我做错了什么?