1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/db/seeds.rb

20 lines
588 B
Ruby
Raw Normal View History

2018-12-01 13:42:36 -05:00
# frozen_string_literal: true
country_states_filename = Rails.root.join 'config', 'country_states.txt'
country_state_names = File.readlines(country_states_filename).map(&:strip)
country_state_names.each do |name|
next if CountryState.where(name: name).exists?
CountryState.create! name: name
end
2018-12-03 20:57:16 -05:00
2018-12-08 22:56:06 -05:00
Rails.application.settings(:superuser).tap do |config|
2018-12-08 22:07:39 -05:00
User.where(email: config[:email]).first_or_create! do |new_user|
2018-12-08 21:14:33 -05:00
new_user.account = Account.create!
2018-12-08 22:07:39 -05:00
new_user.password = config[:password]
2018-12-08 21:14:33 -05:00
new_user.confirmed_at = Time.zone.now
end.account.add_role :superuser
end