Rails plugin - install as a plugin or install as a gem

I am new to rails and ask a question about plugins. There seem to be two approaches you can take when using a third-party plugin in a ROR application:

1) install the gem using sudo gem install GEM and then β€œask” it in the rails project

2) install the plugin using script / generate plugin install PLUGIN. The plugin code is displayed in the directory of your provider, and then you are good to go (sometimes I could not get Devise to work using this method).

Since it seems that both of these methods do the same thing, why should I choose one method over the other.

Thank,

+3
source share
1 answer

Try installing the gem version when you can. There are several benefits you get over plugins:

  • You can enable or disable them for specific environments.
  • You can update them through gem update. With the help of plugins, you will have to manually exit and update them yourself.
  • They are common systems, so if you are creating a new project, you can use them without reinstalling them if you used them in a previous project. You will have to copy / paste the plugins.
  • Plugins are specific to rails, but there are no gems. It is possible to use a gem outside of Rails.

, rake gems:unpack. "" , , ( , rake gems:install).

+6

Source: https://habr.com/ru/post/1746191/


All Articles