如何在 Rails 中访问初始化文件中的变量
我有 Devise 和 Devise_RPX_Connectable (https://github.com/chrisdebruin/devise_rpx_connectable) 正在工作(用户可以使用他们的 Facebook 帐户登录)。我正在使用
rails -v 2.3.5 devise --version 1.0.8 devise_rpx_connectable --version 0.1.3
我的问题是如何访问控制器中的高级用户信息?具体来说,下面列出的内容位于初始化器目录中的 devise.rb 文件中。
config.rpx_auto_create_account = true # false if you don't want to create users automaticaly. True by default.
config.rpx_additional_user_data = [:verifiedEmail, :url, :providerName,:photo] # default [], get some extra profile info from RPXnow, default only a few fields are available in the rpx_user object (https://rpxnow.com/docs#profile_data)
config.rpx_extended_user_data = true # false by default, extended data only available for Plus and Pro RPX users (https://rpxnow.com/docs#api_auth_info)
谢谢,
I have Devise and Devise_RPX_Connectable (https://github.com/chrisdebruin/devise_rpx_connectable) working (users can login with their facebook account). I'm using
rails -v 2.3.5 devise --version 1.0.8 devise_rpx_connectable --version 0.1.3
My question is how do I access the advanced user information in my controllers? Specifically the ones listed below are in my devise.rb file in the initializers directory.
config.rpx_auto_create_account = true # false if you don't want to create users automaticaly. True by default.
config.rpx_additional_user_data = [:verifiedEmail, :url, :providerName,:photo] # default [], get some extra profile info from RPXnow, default only a few fields are available in the rpx_user object (https://rpxnow.com/docs#profile_data)
config.rpx_extended_user_data = true # false by default, extended data only available for Plus and Pro RPX users (https://rpxnow.com/docs#api_auth_info)
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查看了 Devise 源代码,看起来那些正在使用 Rails 的 mattr_accessor< /a> 方法应该在 Devise 模块上公开公开它们。您应该能够像这样访问它们:
I checked out the Devise source and it looks like those are using Rails' mattr_accessor method which should expose them publicly on the Devise module. You should be able to access them like so: