You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to solve something similar to @Kinaan in #32
We have a long lived Rails application with many tables and many columns and other business units that write sql queries against our database. Renaming English columns (:name to :name_en) would break many of our external dependencies.
I'm considering a different approach and offer it here if it is helpful to anyone else.
Step 1, we add in :name_en which is what traco will treat as the source of truth for the data
Step 2, we make sure that :name is in-sync with :name_en for all of our external dependencies.
class Product < ActiveRecord::Base
translates :name, :description
before_save do
write_attribute(:name, name_en)
write_attribute(:description, description_en)
end
before_update do
write_attribute(:name, name_en)
write_attribute(:description, description_en)
end
end
Just realized that for ActiveAdmin, we'll want to disable editing name and edit name_en instead.
The text was updated successfully, but these errors were encountered:
I was trying to solve something similar to @Kinaan in #32
We have a long lived Rails application with many tables and many columns and other business units that write sql queries against our database. Renaming English columns (:name to :name_en) would break many of our external dependencies.
I'm considering a different approach and offer it here if it is helpful to anyone else.
Step 1, we add in :name_en which is what traco will treat as the source of truth for the data
Step 2, we make sure that :name is in-sync with :name_en for all of our external dependencies.
Just realized that for ActiveAdmin, we'll want to disable editing
name
and editname_en
instead.The text was updated successfully, but these errors were encountered: