Improve "db/seeds.rb"
This commit is contained in:
parent
09c86d53a8
commit
393c0af25c
1 changed files with 4 additions and 3 deletions
|
@ -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|
|
||||||
|
|
Reference in a new issue