Reputation: 173
In order to track activity in my application, I built a set of helpers which take in arrays of data and spit out .csv files. I want to use these from the console like so:
helper.export_data(array_of_data)
This works fine on my machine, but the heroku console doesn't seem to let me call helper functions. I receive the error:
NameError: undefined local variable or method `helper' for main:Object
Upvotes: 2
Views: 266
Reputation: 19257
Had same question, and found the answer here: http://www.funonrails.com/2011/03/accessing-view-helpers-routes-in-rails.html
relevant part is:
>> include ActionView::Helpers
>> => Object
>> include ApplicationHelper
>> => Object
>> include ActionView::Helpers::ApplicationHelper^C
>> display_amount 2500 => "$2,500"
Upvotes: 1
Reputation: 22240
I would guess here that your application is doing some sort of initialisation to get helper
loaded into your console, and that that initialisation isn't occurring when you spin up a Heroku console.
Is there anything that you have done in your code which initialises this helper
object?
Upvotes: 1