Skip to content

Instantly share code, notes, and snippets.

@mt9304

mt9304/seeds.rb Secret

Last active October 8, 2018 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mt9304/c67f4e862fedfaa01c47e9934f5663c9 to your computer and use it in GitHub Desktop.
Save mt9304/c67f4e862fedfaa01c47e9934f5663c9 to your computer and use it in GitHub Desktop.
Role.create(name: 'admin')
Role.create(name: 'normal_user')
user1 = User.create(email: 'admin@mediocreinventions.com',
password: 'qwerty123',
password_confirmation: 'qwerty123')
user1.add_role(:admin)
user2 = User.create(email: 'user@mediocreinventions.com',
password: 'qwerty123',
password_confirmation: 'qwerty123')
user2.add_role(:normal_user)
1.upto(5) do |i|
Book.create(title: "Book #{i}", author: "Author #{i}", description: "A sample book", pages: i*10, published: "2018-#{i}-10")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment