Reputation: 581
I Have an engine in vendor/plugins. My problem is, that i seemingly can´t extend the engine-model with a model in the base application.
My folder structure:
APPNAME
-app
-models
-item.rb
-vendor
-plugins
-image_gallery
-app
-models
-image_gallery.rb
Nothing special... in my image_gallery.rb i have just this:
class ImageGallery < Item
end
But Rails complains about missing methods which are defined in item.rb. If i define them in the image_gallery.rb, it works.
Upvotes: 2
Views: 1107
Reputation: 5527
You can try to set config.cache_classes = true
in your development.rb
Upvotes: 1
Reputation: 5058
I believe this is a load order problem. The vendor directory doesn't get reloaded in development mode. The model in your app hasn't been loaded when you engine model tries to inherit from it.
Sorry I don't know a fix for this and have never found one. I think rails 3 will be addressing this. We normally just keep the related models in the same engine or move the engine stuff up into the main app to avoid it. This sucks and I would love to know the proper solution.
Try in production mode and you shouldn't have the issue. You could look at using shotgun if this is the case.
Upvotes: 1