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:
@@ -109,3 +109,17 @@ section "Creating Valuation Assignments" do
|
|||||||
Budget::Investment.all.sample.valuators << Valuator.first
|
Budget::Investment.all.sample.valuators << Valuator.first
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user