Skip to content

Instantly share code, notes, and snippets.

View mwenyoa's full-sized avatar
🏠
Working from home

Anthony Mwenyo mwenyoa

🏠
Working from home
View GitHub Profile
@mwenyoa
mwenyoa / index.md
Created August 9, 2022 05:05 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.