Make budgets translatable
This commit is contained in:
@@ -26,14 +26,17 @@ end
|
||||
|
||||
section "Creating Budgets" do
|
||||
Budget.create(
|
||||
name: "#{I18n.t('seeds.budgets.budget')} #{Date.current.year - 1}",
|
||||
currency_symbol: I18n.t('seeds.budgets.currency'),
|
||||
phase: 'finished'
|
||||
name_en: "#{I18n.t("seeds.budgets.budget", locale: :en)} #{Date.current.year - 1}",
|
||||
name_es: "#{I18n.t("seeds.budgets.budget", locale: :es)} #{Date.current.year - 1}",
|
||||
currency_symbol: I18n.t("seeds.budgets.currency"),
|
||||
phase: "finished"
|
||||
)
|
||||
|
||||
Budget.create(
|
||||
name: "#{I18n.t('seeds.budgets.budget')} #{Date.current.year}",
|
||||
currency_symbol: I18n.t('seeds.budgets.currency'),
|
||||
phase: 'accepting'
|
||||
name_en: "#{I18n.t("seeds.budgets.budget", locale: :en)} #{Date.current.year}",
|
||||
name_es: "#{I18n.t("seeds.budgets.budget", locale: :es)} #{Date.current.year}",
|
||||
currency_symbol: I18n.t("seeds.budgets.currency"),
|
||||
phase: "accepting"
|
||||
)
|
||||
|
||||
Budget.all.each do |budget|
|
||||
|
||||
16
db/migrate/20190118135741_add_budget_translations.rb
Normal file
16
db/migrate/20190118135741_add_budget_translations.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class AddBudgetTranslations < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
Budget.create_translation_table!(
|
||||
{
|
||||
name: :string
|
||||
},
|
||||
{ migrate_data: true }
|
||||
)
|
||||
end
|
||||
|
||||
def self.down
|
||||
Budget.drop_translation_table!
|
||||
end
|
||||
|
||||
end
|
||||
11
db/schema.rb
11
db/schema.rb
@@ -266,6 +266,17 @@ ActiveRecord::Schema.define(version: 20190205131722) do
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "budget_translations", force: :cascade do |t|
|
||||
t.integer "budget_id", null: false
|
||||
t.string "locale", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "name"
|
||||
end
|
||||
|
||||
add_index "budget_translations", ["budget_id"], name: "index_budget_translations_on_budget_id", using: :btree
|
||||
add_index "budget_translations", ["locale"], name: "index_budget_translations_on_locale", using: :btree
|
||||
|
||||
create_table "budget_valuator_assignments", force: :cascade do |t|
|
||||
t.integer "valuator_id"
|
||||
t.integer "investment_id"
|
||||
|
||||
Reference in New Issue
Block a user