Getting started with rails? Must have gems?

2019-02-02 01:45发布

问题:

I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book.

Anyway, my question is a bit more pointed than how do I get started...

What are some of the must have gems that everyone uses?

I need basic authentication, so I have the restful authentication gem, but beyond that, I don't know what I don't know. Is there a run down of this information somewhere? Some basic setup that 99% of the people start with when starting a new rails application?

Thanks in advance.

回答1:

The gems and plugins that I tend to use on most of my projects are:

  • Restful Authentication -- For authentication
  • Will Paginate -- For pagination
  • Attachment Fu -- For image and file attachments
  • RedCloth -- For textile rendering
  • Capistrano -- For deployment


回答2:

For pagination, will_paginate.



回答3:

This is very, very subjective because it all depends on what your application does! However, I've just had a look at the Gems I have installed and the one that absolutely does leap out as mandatory is Capistrano.

BTW Restful Authentication is a Rails plugin not a Gem.



回答4:

HAML is a must have. You'll never think of HTML in the same way again -- No more tag soup.



回答5:

  • sudo gem install haml
  • sudo gem install ZenTest
  • rspec on rails


回答6:

How can nobody have mentioned andand yet? It's the best thing since ||=



回答7:

The only gems you need are:

  • Rails
  • Rake

If you "gem install rails" you'll get everything you need for Rails. You only need gems when you need them, so it's not worth worrying about before then.

EDIT: Actually there are a couple more you'll probably need:

  • mysql - or whatever Ruby database driver you need
  • mongrel - you don't necessarily need this until production, but it's nice to use in dev/test too
  • ZenTest - I use this mainly for "autotest" so that my tests run in a console window whenever my source files change

There could be many other gems that help you but we'd need more info from you to know if they're applicable, eg:

  • Web scraping (hpricot)
  • CSV (fastercsv)
  • Amazon S3 support (aws-s3)
  • Image manipulation (rmagick)
  • Graphing (gruff) - I use this as a plugin
  • Role-based security (role_requirement) - This one is a plugin too


回答8:

mini_magick instead of rmagick.



回答9:

Might want to keep an eye on: http://rubygems.org/ - you can see some interesting stats there re: most downloaded, most active, etc...

Also interesting and somewhat telling: https://github.com/languages/Ruby



回答10:

This is a old thread but I thought I'll refine the list with what I believe to be must have gems at this point in time:

  • RSpec or Shoulda - tools for BDD/testing
  • factory_girl - fixture replacement
  • will_paginate - simple pagination
  • paperclip - image uploading/attachment
  • CanCan - authorization
  • Authlogic - authentication
  • HAML - templating engine