Sha256: ed5f03f71ffc4a9a87ad4427dfa271dd46e4abfa9e1a35f09c3b318f3d02c4da

Contents?: true

Size: 874 Bytes

Versions: 6

Compression:

Stored size: 874 Bytes

Contents

# Put, inside the load method, the necessary code to generate data with DEVELOPMENT PURPOSES.
# Whenever you can, use FactoryGirl's methods to keep this code "self updated".
#
# For Example:
#
# Having a country factory in /spec/factories/countries.rb
#
# FactoryGirl.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 FactoryGirl::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

6 entries across 6 versions & 1 rubygems

Version Path
potassium-5.1.4 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.1.3 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.1.2 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-5.1.1 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-3.0.0 lib/potassium/assets/seeds/admin_data_loader.rb
potassium-2.3.0 lib/potassium/assets/seeds/admin_data_loader.rb