Gem là thư viện (package) Ruby được phân phối qua RubyGems.org.
- Rails chính nó cũng là một gem.
- Trong project, dependency được khai báo trong
Gemfilevà quản lý bởi Bundler.
ruby
# Gemfile
gem "devise" # authentication
gem "pundit" # authorization
gem "sidekiq" # background jobs
group :development, :test do
gem "rspec-rails"
endGemfile.lock lưu phiên bản đúng đắn đang dùng — commit file này vào git để mọi người trong team dùng cùng phiên bản.
A Gem is a Ruby library (package) distributed via RubyGems.org.
- Rails itself is a gem.
- In a project, dependencies are declared in the
Gemfileand managed by Bundler.
ruby
# Gemfile
gem "devise" # authentication
gem "pundit" # authorization
gem "sidekiq" # background jobs
group :development, :test do
gem "rspec-rails"
endGemfile.lock records exact versions in use — commit this file to ensure every team member uses the same versions.