[RUBY] Rails learning Day 1 Part 2

Ruby on Rails5 Quick Learning Practice Guide chapter2

2-6-1-1 Create a new Rails application

$ rails new scaffold_app -d postgresql

rails new: Create a new Rails file scaffold_app: file name -d postgresql: SQL specification (-d means postgreSQL)

2-6-1-2 Create a template for user management functions

$ bin/rails generate scaffold user name:string address:string age:integer

bin/rails: scaffold: A tool that makes it easy to put together the work of creating an app user: model name (user model) name: string address: string age: integer: Create a table by putting 3 pieces of information into the table.

Column YAML basics

YAML is a format for representing structured data.

animal: &animal
 cat: 'cat'
 dog: 'Dog'

animal_shop_1:
  <<: *animal
  hamster: 'hamster'

animal_shop_2:
  <<: *animal
  parrot: 'Parrot'

Keep animal as & animal So & animal = cat:'cat' dog:'dog'

animal_shop_1 is <<: *animal hamster:'hamster'

In other words & Animal and hamster:'hamster' cat:'cat' dog:'dog' hamster: become'hamster'

Recommended Posts

Rails learning day 2 part 2
Rails learning day 1 part 3
Rails learning day 3 part 2
Rails learning Day 1 Part 2
Rails learning day 3
Rails learning day 4
Rails learning day 2
rails learning day 1
Programming learning day 3
Java learning day 5
Rails Docker ~ Part 1 ~
java learning day 2
java learning day 1
Rails Tutorial Chapter 3 Learning
[Rails] Learning with Rails tutorial
Rails Tutorial Chapter 4 Learning
Rails Tutorial Chapter 1 Learning
Rails Tutorial Chapter 2 Learning
Ruby on rails learning record -2020.10.03
Ruby on rails learning record -2020.10.04
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
4th day of java learning
Ruby on rails learning record-2020.10.07 ①
Rails 5 Code Reading Part 2 ~ Action View ~
rails learning rake task, cron, whenever
Rails Tutorial 6th Edition Learning Summary Chapter 10
Rails Tutorial 6th Edition Learning Summary Chapter 7
Rails Tutorial 6th Edition Learning Summary Chapter 4
Rails 5 Code Reading Part 1 ~ ActiveRecord new Method ~
Rails Tutorial 6th Edition Learning Summary Chapter 9
Rails Tutorial 6th Edition Learning Summary Chapter 6
Rails Tutorial 6th Edition Learning Summary Chapter 5
Rails Tutorial Chapter 0: Preliminary Basic Knowledge Learning 5
Rails Tutorial 6th Edition Learning Summary Chapter 3
Muscle Ruby on Rails Day 1 ~ Environment Construction ~
Rails Tutorial 6th Edition Learning Summary Chapter 8