Forum: Ruby Help with ActiveRecord

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
290cf664d9e6f823fc3af57556493db7?d=identicon&s=25 PJ Hyett (Guest)
on 2006-05-05 19:42
(Received via mailing list)
Model:

class AdminQueue < ActiveRecord::Base
  set_table_name 'adminqueue'
end

Interacting with it in script/console

>> AdminQueue.new
=> #<AdminQueue:0x240a910 @attributes={"topic_id"=>nil,
"resolved"=>nil, "updated_on"=>nil, "action"=>nil, "type"=>nil,
"post_id"=>nil, "mod_name"=>nil, "count"=>1, "user_id"=>nil,
"comment"=>nil}, @new_record=true>

>> AdminQueue.find(:all)
SyntaxError: (eval):1:in `compute_type': compile error
(eval):1: parse error, unexpected tINTEGER
Object::0
         ^
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:in
`compute_type'
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:983:in
`instantiate_without_callbacks'
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/callbacks.rb:215:in
`instantiate'
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in
`find_by_sql'
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in
`find_by_sql'
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:924:in
`find_every'
        from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:381:in
`find'
        from (irb):7

Any ideas?

Thanks,
PJ
290cf664d9e6f823fc3af57556493db7?d=identicon&s=25 PJ Hyett (Guest)
on 2006-05-05 19:42
(Received via mailing list)
Sorry guys, I meant to post this in the Rails mailing list.

-PJ
5984d13b1e54f013591e75d476a807df?d=identicon&s=25 Dave Lains (Guest)
on 2006-05-05 19:51
(Received via mailing list)
Any field named 'type' is special in Rails, it enables single table
inheritance and is expected to be a character field. Try renaming the
field to 'queue_type' or something along those lines.

Dave
290cf664d9e6f823fc3af57556493db7?d=identicon&s=25 PJ Hyett (Guest)
on 2006-05-05 21:21
(Received via mailing list)
Thanks Dave, I had a naming conflict just yesterday as well, I really
need to pay closer attention.

-PJ
This topic is locked and can not be replied to.