views:

195

answers:

2

Hey guys,

I am new to rails and have a question regarding the plugins. It seems there are two approaches you can take when using a third party plugin in a ROR App:

1) install a gem using sudo gem install GEM, and then "require" it in your rails project

2) install the plugin using script/generate plugin install PLUGIN. The plugin in code appears in your vendor directory and then you are good to go (sometimes, i could not get Devise working via this method).

Since it appears both of these methods accomplish them same thing, why should I choose one method over the other.

Thanks,

+5  A: 

Try to install the gem version of something when you can. There are a couple of benefits you get over plugins:

  • You can have them enabled or disabled for specific environments
  • You can update them via gem update. With plugins, you'd have to manually go out and update them yourself.
  • They are shared system wide, so if you create a new project, you can use them without having to reinstall them if you used them in a previous project. You'd have to copy/paste plugins.
  • Plugins are specific to rails, but gems are not. It's possible to use a gem outside of Rails.

You can still unpack gems to your vendor directory by running rake gems:unpack. This is useful to "lock in" gems to their current version, and also makes for quicker deployment since you don't have to fetch them from a 3rd party site (which is the case if you do rake gems:install).

ryeguy
+2  A: 

Hi Joseph

I also had the same question

check this question

http://stackoverflow.com/questions/2825711/what-is-the-best-to-use-ruby-gems-or-ruby-plugins

cheers, sameera

sameera207