Heroku console doesn’t run loops in my app (though they work on my local machine AND heroku permits individual actions to be taken).
@companies.each do |c|
SyntaxError: /home/heroku_rack/lib/console.rb:150: syntax error, unexpected $end
@companies.each do |c|
^
/home/heroku_rack/lib/console.rb:140:in `eval'
/home/heroku_rack/lib/console.rb:140:in `_eval'
/home/heroku_rack/lib/console.rb:73:in `block in process_command'
/usr/ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
Do you know why these errors might be occurring?
it’s not an error – it’s a feature of how Heroku let’s you interact with your application via the
heroku consolecommand – whilst appearing like a full console it simply isn’t. Each line is transmitted over http and evaluated when you press enter so you can’t actually use multiline commands, this will work though;if it can’t be written on one line you’ll need to use a rake task or such like
EDITED: To contain correct syntax