Weird ActiveRecord Foreign Key Problem

Hello to all,
I ran into a weird problem with an ActivRecord. I have a table named
“build_order” with a column named “type” that is a foreign key to a
table called “building_type”. In a controller I try to read all the
build_orders with “BuildOrder.find :all” and get the following error and
stack trace:

(eval):1:in instance_eval': compile error (eval):1: syntax error Object::0 ^ c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:ininstance_eval’
c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:in
instance_eval' c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:incompute_type’
c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:983:in
instantiate_without_callbacks' c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/callbacks.rb:215:ininstantiate’
c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in
find_by_sql' c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:incollect!’
c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in
find_by_sql' c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:924:infind_every’
c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:381:in
find' #{RAILS_ROOT}/app/controllers/building_controller.rb:14:inindex’

If I replace the “find :all” with an “find_sql” where I read all the
columns except the “type” column, the error doesn’t occur. The type of
the column is “type INTEGER UNSIGNED NOT NULL”. Is there anyone who have
an idea what I might making wrong here?

Thanks in advance and best regards
Torsten

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs