Sha256: ccab7a290ec63a793d59bada83e373b701345a87e3d23a18ddd4ecaa0f2cfc9f

Contents?: true

Size: 780 Bytes

Versions: 31

Compression:

Stored size: 780 Bytes

Contents

require 'active_record'

class DatabaseHelper
  # Simple DB seeding to avoid bringing in other gems like FactoryGirl etc.
  # This does the job for an example seeder
  def self.seed!
    user_data = [
      {id: 11, first_name: 'Peter', last_name: 'Praxis', uuid: 'deadbeef', email: 'peter@pan.com'},
      {id: 12, first_name: 'Alice', last_name: 'Trellis', uuid: 'beefdead', email: 'alice@wonderland.com'},
      {id: 13, first_name: 'Wellington', last_name: 'Lofty', uuid: 'beefbeef', email: 'well@lofty.com'},
    ]
    (100..199).each do |i|
      user_data.push id: i, first_name: "User-#{i}", last_name: "Last-#{i}", uuid: SecureRandom.hex(16).to_s
    end
    user_data.each_with_index do |data, i|
      ::User.create(**data)
    end
    puts "Database seeded."
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
praxis-2.0.0 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.40 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.39 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.38 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.37 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.36 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.35 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.34 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.33 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.32 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.31 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.30 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.29 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.28 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.27 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.26 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.25 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.24 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.23 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb
praxis-2.0.pre.22 tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb