How can I access this helper function during production?

I use private_pub to send notifications to subscribers to clients. In my application application.html.haml I have:

... = javascript_include_tag 'application' = subscribe_to "/#{@user.access_token}/notifications" ... 

The subscribe_to helper works great in development. When deployed to production, the following error is logged:

 ActionView::Template::Error (undefined method `subscribe_to' for #<#<Class:0x00000001f372e8>:0x00000001fded90>): 5: = stylesheet_link_tag 'application', :media => 'all' 6: = include_gon(:init => true) 7: = javascript_include_tag 'application' 8: = subscribe_to "/#{@user.access_token}/notifications" 9: = csrf_meta_tags 10: 11: %body app/views/layouts/application.html.haml:8:in `_app_views_layouts_application_html_haml__1867651381877570337_14592040' 

How can I access this helper method in my production environment?

+8
ruby-on-rails ruby-on-rails-3 helper
source share
2 answers

It looks like an error loading the PrivatePub engine. If you look at engine.rb , you will see that it adds helpers of the form PrivatePub as part of init. It may be a mistake if it is downloaded for development, but not for the production environment.

Try creating the configuration / initializers that the PrivatePub helpers load manually:

 require 'private_pub/view_helpers' ActionView::Base.send :include, PrivatePub::ViewHelpers 
+3
source share

Is your deployment script running a Faye file file? rackup private_pub.ru -s thin -E production

0
source share

All Articles