LoginSignup
0
0

More than 5 years have passed since last update.

railsでscaffoldを使う(簡易手順)

Last updated at Posted at 2018-11-24

はじめに

Ruby on RailsでHelloWorldプロジェクト でScaffoldを使わずにプロジェクト作成をした。
Scaffoldってどうなんだろうと思い、使ってみました。

サクッと作れたので簡単にまとめてみました。
これだけのコマンドでWebアプリが作れてしまうのは凄いですね…。

作成〜起動

> bundle init
(Gemfile修正)
> bundle install --path vendor/bundle
> bundle exec rails new . -B -d mysql
> Y
> bundle install --path vendor/bundle
(database.yml修正)
> bundle exec rake db:create
> bundle exec rails generate scaffold ScaffoldMessage name:string mail:string title:string message:string
> bundle exec rake db:migrate
> bundle exec rails server

scaffoldで作成したファイルを全削除する場合

> bundle exec rails destroy scaffold ScaffoldMessage

参考

データ型
https://www.javadrive.jp/rails/model/index4.html#section2

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0