パンくずリスト
書籍 RailsによるアジャイルWebアプリケーション開発
seeds.rbによるテストデータの定義
概要
seeds.rbによるテストデータの定義
詳細
seeds.rbを編集し、コマンドを実行することでテストデータを投入することができます。
rake db:seed
テストデータ設定
seeds.rb
Product.delete_all
Product.create(title:'Programming Ruby 1.9',
description:
%{<P>
Ruby is the fastest growing and xxxxx
xxx
xxx
</p>},
image_url: 'ruby.jpg',
price: 49.95)