设计身份验证未定义方法“to_sym”?
我正在尝试使用 LDAP 活动目录设置身份验证系统。 (遵循教程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
在哪里,因为它没有告诉我!任何人都知道其中的原因或至少如何找到包含此行的文件? *******更新* ******
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
Im trying to set up an authentication system against an LDAP active directory using devise. (following the tutorial http://wiki.phys.ethz.ch/readme/devise_with_ldap_for_authentication_in_rails_3
Ive followed the instruction exactly, and when i try running the app im getting the following error:
undefined method `to_sym' for #<ActiveModel::MassAssignmentSecurity::WhiteList:0x2a4abd50
And i dont even know where to_sym
is because it doesnt tell me! Anyone know the cause of this or at least how to find the file that contains this line?
*******UPDATE*******
user.rb model:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来在
devise
方法的最后一个参数后面有一个尾随逗号:然后 ruby 解释器假定
attr_accessible
是该方法的下一个参数。正确的参数类型是符号,因此它在attr_accessible
上调用to_sym
,这是一个方法,没有to_sym
方法,并引发错误。删除结尾的逗号,它应该可以工作!
It looks like there is a trailing comma after the last argument to the
devise
method:The ruby interpreter then assumes that
attr_accessible
is the next argument to the method. The proper argument type is a symbol, so it callsto_sym
onattr_accessible
, which is a method and does not have ato_sym
method and raises the error.Remove the trailing comma and it should work!