db/seeds.rb
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)
This file should contain all the record creation needed to seed the database with its default values.
The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).




This file should contain all the record creation needed to seed the database with its default values . The data can then be loaded with the rake db : seed ( or created alongside the db with db : setup ) .
def create_user( options = {} )
  user_attributes = { email: 'sam@example.com',
                      password: 'welcome',
                      first_name: "Sam",
                      last_name: "Smith",
                      role: "super_admin" }
  attributes = user_attributes.merge options
  unless User.where(user_attributes.except(:password)).exists?
    User.create! attributes
    puts "Created : #{user_attributes.inspect}"
  end
end
def create_user ( options = { } ) user_attributes = { email : 'sam@example.com' , password : 'welcome' , first_name : "Sam" , last_name : "Smith" , role : "super_admin" } attributes = user_attributes . merge options unless User . where ( user_attributes . except ( :password ) ) . exists? User . create! attributes puts "Created : #{user_attributes.inspect}" end end
This file should contain all the record creation needed to seed the database with its default values.
This file should contain all the record creation needed to seed the database with its default values .
options