开发者

Syntax errors on Heroku, but not on local server (postgresql related?)

开发者 https://www.devze.com 2023-02-01 19:21 出处:网络
I\'m trying to deploy my first app on Heroku (rails 3).It works fine on my local server, but when I pushed it to Heroku and ran it, it crashes, giving a number of syntax errors. These are related to a

I'm trying to deploy my first app on Heroku (rails 3). It works fine on my local server, but when I pushed it to Heroku and ran it, it crashes, giving a number of syntax errors. These are related to a collection of scopes I use like the one below:

  scope :scored, lambda { |score = nil|       
    score.nil? ? {} : where('products.votes_count >= ?', score)
  }

it produces errors of this form:

"syntax error, unexpected '=', expecting '|' "

"syntax error, unexpected '}', expecting kEND"

Why is this syntax making Heroku choke and how can I correct it? Thanks!

EDIT: I was using sqlite on my local machine and Heroku does not support that. Trying to make sure the db is properly configured for PG. I believe I have done that by specifying in the gemfile 开发者_开发百科that sqlite only be used in development. Yet I still get these syntax errors, that interrupt even the db:migrate.

EDIT: So now it seems more likely that my scope syntax doesn't work in postgreSQL. Does anyone know how to convert this properly?


The default-values-for-block-parameters feature was introduced in Ruby 1.9. Ruby 1.8 will not be able to load your application if you use this feature.

The default Ruby on Heroku is 1.8.7. Are you using Ruby 1.9 on your local machine, and Ruby 1.8 on Heroku?

You can find out which stack your Heroku application is currently running on via:

$ heroku stack

You can switch to the Ruby 1.9 stack on Heroku via:

$ heroku stack:migrate bamboo-mri-1.9.2
$ git push heroku --force

The Heroku Docs site has more information on stacks and stack migration.


Those syntax errors don't look like postgresql errors to me. Odd, you've got the same versions of everything on your local server and where you're pushing it to?

0

精彩评论

暂无评论...
验证码 换一张
取 消