Problems with model inheritance in development

Hi!
I have problems when a model inherits from another ActiveRecord model:

class Space < ActiveRecord::Base
end

class Project < Space
end

This only happens in development environment. Not in production, neither
in
testing. And never in the first request after a server restart, always
after
the second request.
So I belive it has to do with something related with class reloading.

It seems like after the reloading, the “Space” part of the Project class
is
missing, like in this error (container_posts is a method of Space):

NoMethodError (undefined method container_posts' for #<Project:0xb4a533cc>): /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:256:inmethod_missing’
/vendor/plugins/cmsplugin/app/controllers/posts_controller.rb:18:in
`index’
[…]

I get other errors related with “stack level too deep”, but I can’t
reproduce
them now

El Friday 29 August 2008 12:43:35 Antonio Tapiador del Dujo
escribió:> testing. And never in the first request after a server restart, always

/vendor/plugins/cmsplugin/app/controllers/posts_controller.rb:18:in

`index’
[…]

I get other errors related with “stack level too deep”, but I can’t
reproduce them now

Here they are. I’ll try to get them a look if I have time…

SystemStackError in PostsController#index

stack level too deep

/usr/lib/ruby/1.8/set.rb:157:in include?' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:104:ininstance_method_already_implemented?’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:82:in
define_attribute_methods' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:71:ineach’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:71:in
define_attribute_methods' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:238:inmethod_missing’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:245:in
method_missing' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2435:inhash’
vendor/plugins/cmsplugin/app/controllers/posts_controller.rb:29:in
uniq' vendor/plugins/cmsplugin/app/controllers/posts_controller.rb:29:inindex’

[…]

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