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

后端 未结 7 1072
Happy的楠姐
Happy的楠姐 2020-11-30 01:23

I\'m doing an engine here, it works alright in stand alone.

When I transform it into a gem, and load it inside another application, I get a lot of undefined errors,

7条回答
  •  无人及你
    2020-11-30 02:07

    You must add the gem file to both the .gemspec file, and your engine.rb file. In the .gemspec file it would be like: s.add_dependency "kaminari", "0.16.1"

    In the engine.rb file at the top add: require "kaminari"

    I think you also need to add the gem to the rails engine Gemfile and bundle install, but I'm not certain if you need it there.

提交回复
热议问题