Ruby on Rials メモ
コマンド
コマンド | 意味 |
---|---|
rails new プロジェクト名 | 新しいプロジェクトを作る |
bundle install | Gemfileのモノがインストールされる |
rails server | サーバーの起動 |
rails generate scaffold モデル名 カラム名:型 カラム名:型 | ?? |
rake db:maigrate | ?? |
rails generate controller Pages アクション名1 アクション名2 | pages/アクション名1, pages/アクション名2でアクセスできるページができる |
rails destroy scaffold 名前 | 失敗などして取り消したい時に使う |
ファイル
ファイル | 意味 |
---|---|
config/routes.rb | URLルーティングファイル |
app/controllers/モデルs_controller | ブラウザ, View, Modelと話すコントローラ |
app/models/モデル.rb | DBと話すModel |
app/views/モデル名/[index,edit,new,show].erb | View |
public/ファイル名.html | 静的HTMLファイル |
views/コントローラ名/アクション名.erb | モデル無しのコントローラが表示するView |
db/migrate/マイグレーションファイル | テーブル定義ファイル |