Setting
Create Controller
rails g controller questions index show new edit
create app / controllers / questions_controller.rb
route get 'questions/index'
get 'questions/show'
get 'questions/new'
get 'questions/edit'
invoke erb
create app / views / questions
create app / views / questions / index.html.erb
create app / views / questions / show.html.erb
create app / views / questions / new.html.erb
create app / views / questions / edit.html.erb
invoke test_unit
create test / controllers / questions_controller_test.rb
invoke helper
create app / helpers / questions_helper.rb
invoke test_unit
invoke assets
invoke scss
create app / assets / stylesheets / questions.scssroutes.rb
Create Model
rails g model question name:string title:string content:text
db/migrate/20210408182548_create_questions.rb
rails db
sqlite> .schema
REATE TABLE sqlite_sequence(name,seq); CREATE TABLE IF NOT EXISTS "questions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "title" varchar, "content" text, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
routes
rails routes
最終更新
役に立ちましたか?