I have a class (not a controller) that generates external javascript that we then store in redis and am using Rails 3.2.19. One of the views calls a helper that is located in application_helper but it is now erroring out saying that it can't find the helper.
I would think that calling ActionView::Base.new would bring in the helpers from application_helper.rb but it doesn't appear to by default. However, on production on heroku, this does work as anticipated. I guess the question is what is the path for the views created via ActionView::Base.new?
I have:
class MenuGenerator
def self.js_external(id)
@menu=Menu.find(id)
str=ActionView::Base.new(
Rails.configuration.paths["app/views"]).render(
:partial => 'api/get_menu_3',
:locals => { :menu => @menu, :format => 'div' })
key='menus/' + id.to_s + '/js-external'
$redis.set(key, str)
return str
end
and have tried including my application_helper via
def self.js_external(id)
include ApplicationHelper
@menu=Menu.find(id)
or
class MenuGenerator
include ApplicationHelper
but neither works. What woudl I need to add to make this helper accessible by my view?