问题
What is the best practice when creating a rails project
1 - is it good to use ruby gems 2 - or is it good to use ruby plugins (as almost all the gems has their plugin versions)
and what are the strengths and weaknesses of eachoption
- consider we are creating the rails project with rails 2.x.x or rails 3
thanks in advance
cheers, sameera
回答1:
I think you should have to go with gems if possible. You will have a rich framework with slim applications. If you use a lot of plugins your application will be too heavy. I'm talking from experience. I have an application with a lot of plugins in it and it is hell slow.
回答2:
I prefer to use gems because then I can manage them with Bundler and it will install the necessary dependencies for me. It will also cache gems, which solves deployment issues.
Also, it isn't possible to use only plugins, there are always gem dependencies, and I'd rather use just one mechanism, so that's another point for gems.
I think that plugins are slowly turning into gems and Rails 3 is moving further in that direction.
回答3:
In my case, I use gems whenever I can but I do use plugins when I don't have access to gems on the host.
For example, Heroku doesn't have all the gems and neither does Media Temple. Since plugins are imported with the project, you can get away with it :)
来源:https://stackoverflow.com/questions/2825711/what-is-the-best-to-use-ruby-gems-or-ruby-plugins