I'm using the Ruby Gems Faker, Populator to create a list of fake users in my development environement.
In my database Schema I have the following table
admin_customers
|- latin_first_name
|- latin_middle_name
|- latin_last_name
|- cyrillic_first_name
|- cyrillic_middle_name
|- cyrillic_last_name
Here is an example of how I would like to store data against each field:
latin_first_name = "Viola"
latin_middle_name = "Lyagushkina"
latin_last_name = "Georgievna"
cyrillic_first_name = "Виола"
cyrillic_middle_name = "Люгашкина"
cyrillic_last_name = "Георгиевна"
This is what my populate.rake file looks like:
namespace :db do
desc "Create 100 customers"
task :populate => :environment do
require 'populator'
require 'faker'
Admin::Customer.destroy_all
Admin::Customer.populate 100 do |customer|
Faker::Config.locale = :ru
customer.cyrillic_first_name = Faker::Name.first_name
customer.cyrillic_middle_name = Faker::Name.last_name
customer.cyrillic_last_name = Faker::Name.last_name
Faker::Config.locale = :en
customer.latin_first_name = Faker::Name.first_name
customer.latin_middle_name = Faker::Name.last_name
customer.latin_last_name = Faker::Name.last_name
end
puts "created 100 users"
end
end
However all the data is generated in Latin, do you know how to generate multiple languages with Faker and Populator to a single record?
Reading the YML file gives clarity into the available commands for the given language, the syntax was correct however the commands required to generate a cyrillic name were not.