Rails Engine – Gems dependencies, how to load them into the application?

Include them in your gemfile and run bundle install. Then require them in your lib/<your_engine>/engine.rb file. Don’t forget to require rubygems

  require 'rubygems'
  require 'paperclip'
  require 'jquery-rails'
  require 'rails3-jquery-autocomplete'
  require 'remotipart'
  require 'cancan'

Then in your host app (The app where you included your gem) run bundle install/ bundle update (bundle update did the trick for me) and then everything should work perfectly. You can also test this by starting the console in your host app and just type the module name e.g.

Loading development environment (Rails 3.0.3)
irb(main):001:0> Paperclip
=> Paperclip

Hope this helps

Leave a Comment