Skip to content

Fix autoload load_path

Gabriel Mazetto requested to merge brodock/fix-load-path into main

When you try to load the gem into an existing application it will fail to load the files as the load_path will behave differently.

Here is the problem before the change:

irb(main):007:0> require 'tanuki_emoji'
=> true
irb(main):008:0> TanukiEmoji.index.all
Traceback (most recent call last):
        7: from /Users/brodock/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `<main>'
        6: from /Users/brodock/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `load'
        5: from /Users/brodock/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        4: from (irb):8
        3: from /Users/brodock/.rvm/gems/ruby-2.7.2/gems/tanuki_emoji-0.2.1/lib/tanuki_emoji.rb:33:in `index'
        2: from /Users/brodock/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        1: from /Users/brodock/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
LoadError (cannot load such file -- ./lib/tanuki_emoji/index)

after it it should work.

Edited by Gabriel Mazetto

Merge request reports