Forum: Rails Engines Problems with model inheritance in development

Posted by Antonio Tapiador del Dujo (Guest)
on 2008-08-29 12:43
(Received via mailing list)
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:in
`method_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
Posted by Antonio Tapiador del Dujo (Guest)
on 2008-09-01 12:13
(Received via mailing list)
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:in
`instance_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:in
`each'
/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:in
`method_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:in
`hash'
vendor/plugins/cmsplugin/app/controllers/posts_controller.rb:29:in 
`uniq'
vendor/plugins/cmsplugin/app/controllers/posts_controller.rb:29:in 
`index'

[...]
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.