Sha256: ec29b63294637e09b90dbe5c33f3d3c4c06c782198cab752baa82f246d27715f

Contents?: true

Size: 871 Bytes

Versions: 15

Compression:

Stored size: 871 Bytes

Contents

# Put, inside the load method, the necessary code to generate data with DEVELOPMENT PURPOSES.
# Whenever you can, use FactoryBot's methods to keep this code "self updated".
#
# For Example:
#
# Having a country factory in /spec/factories/countries.rb
#
# FactoryBot.define do
#   factory :country do
#     name "Chile"
#     locale "es-CL"
#     currency "$CLP"
#   end
# end
#
# Choose to do this:
#
# create(:country)
#
# Instead of this:
#
# Country.create(name: "Chile", locale: "es-CL", currency: "$CLP")
#

Faker::Config.locale = I18n.locale

module FakeDataLoader
  extend FactoryBot::Syntax::Methods

  def self.load
    load_admin
  end

  def self.load_admin
    email = "admin@example.com"
    pass = "password"
    admin = AdminUser.find_by(email: email)
    AdminUser.create!(email: email, password: pass, password_confirmation: pass) unless admin
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
potassium-7.2.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-7.1.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-7.0.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.7.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.6.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.5.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.4.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.3.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.2.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.1.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-6.0.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.2.3 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.2.2 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.2.1 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.2.0 lib/potassium/assets/seeds/admin_data_loader.rb