tonekk
tonekk

Reputation: 478

Require gem automatically

I created a gem which defines a Rails::Railtie. Everything works as expected, except that I have to include the main file of the gem (lib/gem.rb) in my application.rb so it is executed.

Is there any way to do this automatically? I checked some gems, but I could not figure out how.

Upvotes: 2

Views: 1001

Answers (1)

tonekk
tonekk

Reputation: 478

Solved it.

The name of my gem was slightly different from the files' name (gem-name vs lib/gem_name.rb), so I have to put this to my Gemfile:

gem 'gem-name', require: 'gem_name'

Upvotes: 2

Related Questions