Catalog / Ruby on Rails Cheatsheet
Ruby on Rails Cheatsheet
A comprehensive cheat sheet covering essential Ruby on Rails commands, helpers, and best practices for efficient web development.
Rails Basics & Setup
Project Setup
|
Access it via |
|
|
|
|
Generators
Example: |
Example: |
Example: |
Example: |
Basic Commands
|
|
|
Models & Database
ActiveRecord Basics
|
|
|
|
|
|
Associations
|
A model has one of another model. Example: |
|
A model belongs to another model. Example: |
|
A model has many of another model. Example: |
|
A model has many of another model through an association. Example: |
Validations
|
|
|
|
|
Controllers & Views
Controller Actions
|
|
|
|
|
|
|
Views & Templates
ERB (Embedded Ruby) templates are used to generate HTML views. |
|
|
|
|
Layouts & Partials
Layouts provide a consistent look and feel across multiple pages. |
Partials are reusable view templates. |
|
Use |
Routing & Assets
Routes
|
|
|
|
|
Asset Pipeline
The asset pipeline manages CSS, JavaScript, and image assets. |
Assets are located in the |
Use Sprockets directives (e.g., |
|
Helpers
|
|
|
|