apn-on-rails gem 的 Rails3 分支出现 Configatron 错误
当我尝试传递挂起的推送通知(通过 rake 任务和对象调用)时,我收到此错误:
rake aborted!
can't convert Configatron::Store to String (Configatron::Store#to_str gives Configatron::Store)
(See full trace by running task with --trace)
我正在使用 apn_on_rails,在这个 SO 问题,使用 ruby 1.9.2 和 rvm。
Gemfile:
gem 'apn_on_rails', :git => 'https://github.com/natescherer/apn_on_rails.git', :branch => 'rails3'
gem 'configatron'
和我的 config\environments\development.rb:
# development (delivery):
configatron.apn.passphrase # => '1234'
configatron.apn.port # => 2195
configatron.apn.host # => 'gateway.sandbox.push.apple.com'
configatron.apn.cert #=> File.join(RAILS_ROOT, 'config', 'apple_push_notification_development.pem')
有什么想法吗? (免责声明:我是一个 Rails 新手。)
I am receiving this error when I try to deliver pending push notifications (both via the rake task and the object call):
rake aborted!
can't convert Configatron::Store to String (Configatron::Store#to_str gives Configatron::Store)
(See full trace by running task with --trace)
I am using the rails3 branch of apn_on_rails, specified in this SO question, with ruby 1.9.2 and rvm.
Gemfile:
gem 'apn_on_rails', :git => 'https://github.com/natescherer/apn_on_rails.git', :branch => 'rails3'
gem 'configatron'
and my config\environments\development.rb:
# development (delivery):
configatron.apn.passphrase # => '1234'
configatron.apn.port # => 2195
configatron.apn.host # => 'gateway.sandbox.push.apple.com'
configatron.apn.cert #=> File.join(RAILS_ROOT, 'config', 'apple_push_notification_development.pem')
Any ideas? (disclaimer: I am somewhat of a rails newbie.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要将值分配给配置参数,您必须使用 = 运算符。
例如,configatron.apn.passphrase = '1234'。
在 ruby 中,# 标记注释的开始。
To assign a value to a configuration parameter you have to use the = operator.
For example, configatron.apn.passphrase = '1234'.
In ruby # marks the start of a comment.
当我使用 apn_on_rails 时,我自己也研究过这个问题,并注意到它最近开始出现与 Configatron 相同的错误。
我注意到在我更新我的包之后,特别是 Configatron 更新到 3.x 后,这种情况就开始发生了。我降级到 2.13.0,它现在可以正常工作,没有错误 - 我猜 apn_on_rails 与 Configatron v3.x 配合不好。
在 Gemfile 中建议:
然后运行
希望这会有所帮助。
I've been look at this issue myself as I'm using apn_on_rails and have noticed that it's recently started breaking with the same error with Configatron.
I noticed that it started happening after I updated my bundle and, specifically, Configatron up to 3.x. I downgraded to 2.13.0 and it now works without an error - I guess apn_on_rails doesn't play nice with Configatron v3.x.
Suggest in your Gemfile:
and then run
Hope this helps.