Skip to content

Instantly share code, notes, and snippets.

@dominicsayers
Created March 18, 2013 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominicsayers/5187760 to your computer and use it in GitHub Desktop.
Save dominicsayers/5187760 to your computer and use it in GitHub Desktop.
Syntax errors in ActiveRecord schema.rb caused by $\ = ','

If you get schema.rb:16: syntax error, unexpected ',' when you do a rake environment db:setup it may be because the ActiveRecord task that builds this file happens to use the Ruby print statement.

So if you have a default separator set up by using

$\ = ','

somewhere in your code that gets executed before a rake task (e.g. in the header of a class) then schema.rb will end up with stray commas interspersed with the code that gets generated.

Obviously this effect will depend on the default delimiter you've configured but if it's not whitespace, prepare for trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment