1
0
Fork 0

Improve "db/seeds.rb"

This commit is contained in:
Alex Kotov 2019-04-27 17:40:12 +05:00
parent 09c86d53a8
commit 393c0af25c
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -9,9 +9,10 @@ CSV.foreach country_states_filename,
native_name.strip! native_name.strip!
english_name.strip! english_name.strip!
next if CountryState.where(english_name: english_name).exists? CountryState.where(english_name: english_name)
.first_or_create! do |new_country_state|
CountryState.create! english_name: english_name, native_name: native_name new_country_state.native_name = native_name
end
end end
Rails.application.settings(:superuser).tap do |config| Rails.application.settings(:superuser).tap do |config|