apn_on_rails 破坏了 Rails 2.3.8 上的视图助手?

发布于 2024-10-19 23:35:10 字数 1804 浏览 8 评论 0原文

我正在开发一个 Rails 应用程序,它应该向 iOS 设备发送推送通知。我正在使用 apn_on_rails gem。 Rails 控制台中一切正常。但是,当我运行服务器时,所有基本视图方法(例如 content_forform_tag 等)都会出现未定义的方法错误:

当我采取 require 'apn_on_rails'< /code> 从我的 development.rb 出来,视图再次工作,但当然没有推送通知。

这是一个示例跟踪:

Processing DashboardController#index (for 127.0.0.1 at 2011-02-27 13:55:59) [GET]
User Load (0.2ms)   SELECT * FROM "users" WHERE ("users"."id" = 1) 
CACHE (0.0ms)   SELECT * FROM "users" WHERE ("users"."id" = 1) 
Rendering template within layouts/dashboard
Rendering dashboard/index

ActionView::TemplateError (undefined method `content_for' for #<ActionView::Base:0x103343970>) on line #1 of app/views/dashboard/index.html.erb:
1: <% content_for :header do %>
2:  <%= render :partial => "header", :locals => {:title => "Dashboard"} %>
3: <% end %>


app/views/dashboard/index.html.erb:1
app/controllers/dashboard_controller.rb:6:in `index'

Rendered rescues/_trace (28.5ms)


Processing ApplicationController#index (for 127.0.0.1 at 2011-02-27 13:55:59) [GET]

ActionView::TemplateError (undefined method `debug' for #<ActionView::Base:0x103343970>) in /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/templates/rescues/_request_and_response.erb:



Rendered rescues/_trace (24.0ms)
/!\ FAILSAFE /!\  Sun Feb 27 13:55:59 +0100 2011
 Status: 500 Internal Server Error

ActionView::TemplateError (undefined method `debug' for #<ActionView::Base:0x1031eaad8>) in /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/templates/rescues/_request_and_response.erb:




In /library/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/templates/rescues/_request_and_response.erb

感谢您的帮助...

I am developing a rails application which should send push notifications to iOS devices. I am using apn_on_rails gem. Everything works fine in the rails console. However when I run the server, I get undefined method errors for all the basic view methods such as content_for or form_tag etc:

When I take require 'apn_on_rails' from my development.rb out, the views work again, but of course without push notifications.

Here is an example trace:

Processing DashboardController#index (for 127.0.0.1 at 2011-02-27 13:55:59) [GET]
User Load (0.2ms)   SELECT * FROM "users" WHERE ("users"."id" = 1) 
CACHE (0.0ms)   SELECT * FROM "users" WHERE ("users"."id" = 1) 
Rendering template within layouts/dashboard
Rendering dashboard/index

ActionView::TemplateError (undefined method `content_for' for #<ActionView::Base:0x103343970>) on line #1 of app/views/dashboard/index.html.erb:
1: <% content_for :header do %>
2:  <%= render :partial => "header", :locals => {:title => "Dashboard"} %>
3: <% end %>


app/views/dashboard/index.html.erb:1
app/controllers/dashboard_controller.rb:6:in `index'

Rendered rescues/_trace (28.5ms)


Processing ApplicationController#index (for 127.0.0.1 at 2011-02-27 13:55:59) [GET]

ActionView::TemplateError (undefined method `debug' for #<ActionView::Base:0x103343970>) in /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/templates/rescues/_request_and_response.erb:



Rendered rescues/_trace (24.0ms)
/!\ FAILSAFE /!\  Sun Feb 27 13:55:59 +0100 2011
 Status: 500 Internal Server Error

ActionView::TemplateError (undefined method `debug' for #<ActionView::Base:0x1031eaad8>) in /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/templates/rescues/_request_and_response.erb:




In /library/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/templates/rescues/_request_and_response.erb

Thanks for any help...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别念他 2024-10-26 23:35:10

目前尚不清楚您是否调用 config.gem 'apn_on_rails' - 听起来更像是您在 require:ing 库,这可能是您不应该做的事情point:环境设置点。

在您的环境设置中包含 config.gem 内容(即development.rb),但稍后会发生最终的require(-> 在相关的控制器/模型/帮助程序中)。

It is not evident whether you call config.gem 'apn_on_rails' - it sounds more like you are require:ing the library, which probably is something you should not do at this point: the point of environment setup.

Have the config.gem things in your environment setup (i.e. development.rb), but make eventual requires happen later (->in the controller / model / helper in question).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文