Add dev_seeds for milestones with translations

Add one milestone to each investment with translations
for each locale defined in the app.
This commit is contained in:
iagirre
2018-04-16 09:30:21 +02:00
parent 4e5c9e2166
commit 747db0ea35

View File

@@ -109,3 +109,17 @@ section "Creating Valuation Assignments" do
Budget::Investment.all.sample.valuators << Valuator.first
end
end
section "Creating investment milestones" do
Budget::Investment.all.each do |investment|
milestone = Budget::Investment::Milestone.new(investment_id: investment.id, publication_date: Date.tomorrow)
I18n.available_locales.map do |locale|
neutral_locale = locale.to_s.downcase.underscore.to_sym
Globalize.with_locale(neutral_locale) do
milestone.description = "Description for locale #{locale}"
milestone.title = I18n.l(Time.current, format: :datetime)
milestone.save!
end
end
end
end