File tree 3 files changed +10
-9
lines changed
3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
1
+ require 'active_record/fixtures'
2
+
3
+ Product . delete_all
4
+ Fixtures . create_fixtures ( "#{ Rails . root } /test/fixtures" , "products" )
Original file line number Diff line number Diff line change 1
1
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
2
3
3
one :
4
- title : MyString
4
+ title : My first product
5
5
name : MyString
6
6
description : MyText
7
7
8
8
two :
9
- title : MyString
9
+ title : My second product
10
10
name : MyString
11
11
description : MyText
Original file line number Diff line number Diff line change 6
6
#
7
7
user_one :
8
8
9
+ encrypted_password : <%= User.new.send(:password_digest, 'one') %>
10
+ products : one, two
9
11
10
12
# column: value
11
13
#
12
14
user_two :
13
15
16
+ encrypted_password : <%= User.new.send(:password_digest, 'two') %>
17
+ products : two
14
18
15
19
# column: value
You can’t perform that action at this time.
0 commit comments