I created plugin in Rails 4.2.3 which also has some classes in its "lib" folder:
lib/xxx/some_class.rb
Next, I created application and included that plugin as gem:
gem 'myplugin', path: "/path/to/plugin/myplugin"
Unfortunately SomeClass is not visible from within application.
I'm wondering what is best method to include that and other classes from plugin's "lib" folder. I know that in application's application.rb file I could add:
config.autoload_paths += Dir["/path/to/plugin/myplugin/lib/**/"]
But I don't like that I have to explicitly specify entire path to the "lib" folder. Is there better way to do it?
In this case, it should be enough:
In the file using your
SomeClass. To give you an insight on what bundler will do for you (and Rails), they willrequirefor you the file inlib/yourplugin.rb, if yourequire 'xxx/some_class'in that file, it will be "autoloaded" in rails, otherwise you just need to require it in the files you need.