Rails error: syntax error, unexpected tINTEGER Object::1

When trying to do a model.find(), I ran into the error, ’syntax error, unexpected tINTEGER Object::1′. If you have a table that uses a magic or reserved name, such as type, you will get this error. This error was a pain in the ass, but I figured out that you can get by it:

class SomeModel < ActiveRecord::Base
    self.inheritance_column = ''
end

The inheritance_column override is the key, basically giving it a different value to use. Hope this helps!

 

Tags: , , , ,

5 Responses to “Rails error: syntax error, unexpected tINTEGER Object::1”

  1. Jabi Says:

    It helped to find a bug, thanks a bunch!

  2. andro Says:

    You are my hero! Exactly what I need: “type” as column name was the problem!

    thx a lot!

  3. Jeff Says:

    Thank you. I was going crazy with this.

  4. Alex Says:

    Your blog is interesting!

    Keep up the good work!

  5. Satish Says:

    Thanks a lot!

Leave a Reply