「Tep3-onk-2」の版間の差分

提供: wikipokpok
移動先: 案内検索
(generate)
(generate)
41行目: 41行目:
  
 
  % rails generate scaffold List user:references note:references content:string list_line:integer
 
  % rails generate scaffold List user:references note:references content:string list_line:integer
 +
 +
やり直し
 +
% rails destroy scaffold User .................
  
 
  $ rails generate scaffold Post content:text user:references picture:string
 
  $ rails generate scaffold Post content:text user:references picture:string

2022年9月17日 (土) 10:46時点における版

準備

プロジェクトディレクトリ作成
移動
バージョン確認

new

% rails new . -d postgresql --css tailwind
% bundle install
% rails db:create
または
% rails db:reset 
% rails db:migrate
% rails server

daisyui

tailwind css UIコンポーネント インストール

% yarn add daisyui

config/tailwind.config.js

plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/aspect-ratio'),
    require('@tailwindcss/typography'),
    require('daisyui'),    // ← 追記する
  ],

app/views/layouts/application.html.erb

<html data-theme="light">  // テーマを選ぶ

generate

$ rails generate scaffold User name:string email:string password_digest:string remember_digest:string role:integer activation_digest:string activated:boolean activated_at:datetime reset_digest:string reset_sent_at:datetime
% rails generate scaffold Note content:string user:references kind:integer meeting_time:integer role:integer note_line:integer
% rails generate scaffold Client user:references note:references list:references content:string client_line:integer memo:text
% rails generate scaffold Other user:references note:references client:references name:string yomi:string client_name:boolean other_line:integer memo:text generation:string
% rails generate scaffold List user:references note:references content:string list_line:integer

やり直し

% rails destroy scaffold User .................
$ rails generate scaffold Post content:text user:references picture:string
$ rails generate model Relationship follower_id:integer followed_id:integer
$ rails db:migrate RAILS_ENV=production
$ bin/dev
$ rails generate controller StaticPages home help about contact

エラー

ActionView::Template::Error (The asset "tailwind.css" is not present in the asset pipeline.

config/envitonments/production.rb

config.assets.compile = true