Search code examples
ruby-on-railsrubyruby-on-rails-pluginsrails-engines

Rails Engine: Extend model with application class


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.


Solution

  • You can try to set config.cache_classes = true in your development.rb