railsでMVC作成の超簡単な流れ
Hey, guys:)
さて早速ですがターミナルでrailsアプリの基盤であるMVCを作ってみよう!
まずはターミナルでコントローラーから作成!
$ rails generate controller home top
homeはコントローラー名でtopはアクション名だよ!
topアクションのビューファイルも生成されてるよ!
次はモデルとデータベースを作ってみよう!
$ rails generate model Blog title:string content:text
でモデルを作成!
Blogがモデル名でtitle:string / content:text= カラム名:データ型 だよ!
とどめに
rake db:migrate
でデータベースを作っちゃえ!
力が有り余ったので英訳してみた
Lets's create MVC with terminal which is foundation of rails application.
First of all, type below.
$ rails generate controller home top
"home" is the name of controller and "top" is action.
If you want to create the model and database, you can do it easily as below
$ rails generate model Blog title:string content:text
"Blog" = name of database, title:string / content:text = column:Data Type
rake db:migrate
The code of above creates the database of your cool application.
英語のライティングってクソ難しい..
bye guys, see you next time : - )