Unexpected “parse error, unexpected tINTEGER Object” Error

   By chris on February 22nd 2007 in /dev/rails | 1,530 views

Tonight I got this error when executing a .find( :all ) on a seemingly innocuous database table:

compile error
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1359: parse error, unexpected tINTEGER Object::3

After a bit of bashing about I figured out that this was because I’d named one of the fields in the table as type.

The moral of the story: don’t name table fields type or Rails will puke on you. So, are there other not-recommended field names?

7 Responses to “Unexpected “parse error, unexpected tINTEGER Object” Error”

  1. Edd responded on 11 Mar 2007 at 1:47 pm #

    I love you. I’ve been spending hours trying to figure this out, and a random search across the interweb found this. :) We shall spread the word! The sanity of developers across the globe depend on us.

  2. chris responded on 11 Mar 2007 at 2:40 pm #

    Glad I could be of help :D

  3. Marcus Floriano responded on 13 Mar 2007 at 8:08 pm #

    Hi,

    I had the same problem, it could never imagine that this was problem.

    Thank you very much.

  4. Jason Cabot responded on 04 Jul 2007 at 2:59 am #

    Hi,

    Thank You, Thank You, Thank You…

    It’s just a pity that rails doesn’t make things like this more obvious :) – From that error I would never have thought that the problem was with a column name!!

  5. tayfun responded on 20 Nov 2007 at 5:41 pm #

    Thanks a bunch. I couldn’t see this was the problem.

  6. Igor responded on 03 Mar 2008 at 3:07 pm #

    Thanks you very much!
    You saved a lot of my time!

  7. Do not name table columns “type” in Rails « SNBlog responded on 14 Mar 2008 at 1:01 pm #

    [...] March 14, 2008 Or error emissions ensue: Chris tells you why. [...]