Created
January 18, 2015 14:26
-
-
Save jameshibbard/6c1400e770aee9de32ce to your computer and use it in GitHub Desktop.
Devise / cancancan tutorial: seeding the app with data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r1 = Role.create({name: "Regular", description: "Can read items"}) | |
r2 = Role.create({name: "Seller", description: "Can read and create items. Can update and destroy own items"}) | |
r3 = Role.create({name: "Admin", description: "Can perform any CRUD operation on any resource"}) | |
u1 = User.create({name: "Sally", email: "[email protected]", password: "aaaaaaaa", password_confirmation: "aaaaaaaa", role_id: r1.id}) | |
u2 = User.create({name: "Sue", email: "[email protected]", password: "aaaaaaaa", password_confirmation: "aaaaaaaa", role_id: r2.id}) | |
u3 = User.create({name: "Kev", email: "[email protected]", password: "aaaaaaaa", password_confirmation: "aaaaaaaa", role_id: r2.id}) | |
u4 = User.create({name: "Jack", email: "[email protected]", password: "aaaaaaaa", password_confirmation: "aaaaaaaa", role_id: r3.id}) | |
i1 = Item.create({name: "Rayban Sunglasses", description: "Stylish shades", price: 99.99, user_id: u2.id}) | |
i2 = Item.create({name: "Gucci watch", description: "Expensive timepiece", price: 199.99, user_id: u2.id}) | |
i3 = Item.create({name: "Henri Lloyd Pullover", description: "Classy knitwear", price: 299.99, user_id: u3.id}) | |
i4 = Item.create({name: "Porsche socks", description: "Cosy footwear", price: 399.99, user_id: u3.id}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment