Ruby,Rails
データベースをメイン(?)に扱いだしてから 結構な頻度で使うようになったので、メモすることにした。 (結局よく使ってもよく忘れる悲劇・・・) 1.とりあえずまずはマイグレーションファイルを作成する rails g migration 作業内容がわかるようなファ…
APIで取得したデータに日付データ(String型)があったのですが、 Date型に変換したかったので調べた。 Date.strptime('String型の日付データ', '%Y-%m-%d') 'String型の日付データ'.to_date どっちでもいけた。 これだけでよかったのか・・・(゜ω゜=) ※追記…
Bootstrap4 Gemfileに追記する gem 'bootstrap' gem'jquery-rails' application.scssに追記する // Custom bootstrap variables must be set or imported *before* bootstrap. @import "bootstrap"; application.jsに追記する //= require jquery3 //= requi…
コマンド rails generate model model名 [カラム名:型] [カラム名:型] [カラム名:型] ...[オプション] データ型 binary boolean date datetime decimal float integer primary_key string text time timestamp rails consoleでDBに追加するときのコマンド DB…