This is a draft cheat sheet. It is a work in progress and is not finished yet.
Creating a Database Model
rails g model Product name:string
|
|
Change database to add or remove tables
Console
|
|
See columns in user table |
|
Create a user |
|
save the user |
|
To see the details of user |
|
|
User.where(name: 'name')
|
|
|
user.update(name: "BC")
|
|
|
new vs create
new - builds new User, not save to db. You need to call save object |
create - Builds a new Product object and immediately saves it to the database (runs validations). |
|
|
|
|
|