Use gem as library in Rails 4

Passionate Engineer

Is there a way to use a gem as a library in Rails 4?

I have tried putting in a gem folder after cloning into lib folder but this doesn't seem to be working

Nick Kugaevsky

You can set local path to gem in your Gemfile if I clearly understood the problem.

# Gemfile
gem 'my_perfect_gem', path: './path/to/my_perfect_gem'

I think it's better to set local gem location only in development and test environments, so wrap this line in a group. Unfortunately you should restart your rails server any time you've updated the gem.

May be there is a better approach such as using your gem as a part of application in lib folder – Auto-loading lib files in Rails 4

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related