「Tep8」を編集中
この編集を取り消せます。
下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 | 編集中の文章 | ||
1行目: | 1行目: | ||
[[category:memo|{{PAGENAME}}]] | [[category:memo|{{PAGENAME}}]] | ||
== 準備 == | == 準備 == | ||
− | |||
− | |||
== create application == | == create application == | ||
% rails new . --css=tailwind --css=sass --javascript=esbuild --database=postgresql | % rails new . --css=tailwind --css=sass --javascript=esbuild --database=postgresql | ||
15行目: | 13行目: | ||
% bin/setup | % bin/setup | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== user == | == user == | ||
27行目: | 19行目: | ||
<nowiki>% bin/rails generate devise User | <nowiki>% bin/rails generate devise User | ||
− | + | Confirmableをコメントアウトする | |
% bin/rails db:migrate</nowiki> | % bin/rails db:migrate</nowiki> | ||
40行目: | 32行目: | ||
# config/initializers/devise.rb | # config/initializers/devise.rb | ||
config.scoped_views = true | config.scoped_views = true | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== home == | == home == | ||
110行目: | 88行目: | ||
application.register("hello", HelloController)</nowiki> | application.register("hello", HelloController)</nowiki> | ||
− | == | + | == company == |
− | rails generate scaffold | + | rails generate scaffold Company name:string |
関連付け | 関連付け | ||
− | % bin/rails generate migration | + | % bin/rails generate migration add_company_reference_to_users company:references |
% bin/rails generate migration add_note_reference_to_name_list note:references | % bin/rails generate migration add_note_reference_to_name_list note:references | ||
nullを許可する | nullを許可する | ||
− | add_reference :users, : | + | add_reference :users, :company, foreign_key: true |
− | belongs_to : | + | belongs_to :company, optional: true |
bin/rails db:drop db:create db:migrate | bin/rails db:drop db:create db:migrate | ||
% rails generate controller Companies new create | % rails generate controller Companies new create | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== note == | == note == | ||
136行目: | 108行目: | ||
関連付け | 関連付け | ||
− | % bin/rails generate migration | + | % bin/rails generate migration add_company_reference_to_notes company:references |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == | + | == 見出しタイトル == |
% rails generate scaffold NameList name:string kana:string head:boolean line:integer buddhist_name:string alive:boolean birth:string death:string g_age:string memo:text generation:string | % rails generate scaffold NameList name:string kana:string head:boolean line:integer buddhist_name:string alive:boolean birth:string death:string g_age:string memo:text generation:string | ||