设计身份validation未定义方法’to_sym’?
我试图使用设计针对LDAP活动目录设置身份validation系统。 (按照教程http://wiki.phys.ethz.ch/readme/devise_with_ldap_for_authentication_in_rails_3
我完全按照指示,当我尝试运行应用程序时,我得到以下错误:
undefined method `to_sym' for #<ActiveModel::MassAssignmentSecurity::WhiteList:0x2a4abd50
我甚至不知道to_sym
在to_sym
,因为它没有告诉我! 任何人都知道这个的原因或至少如何找到包含这一行的文件? * ** * ** * 更新 * ** * ** *
user.rb模型:
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :ldap_authenticatable, :rememberable, :trackable, # Setup accessible (or protected) attributes for your model attr_accessible(:login, :password, :password_confirmation, :remember_me) end
看起来在devise
方法的最后一个参数之后有一个尾随逗号:
devise :ldap_authenticatable, :rememberable, :trackable,
然后,ruby解释器假定attr_accessible
是该方法的下一个参数。 正确的参数类型是一个符号,因此它在to_sym
上调用to_sym
,这是一个方法,并且没有to_sym
方法并引发错误。
删除尾随的逗号,它应该工作!