# frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base primary_abstract_class class << self def translates_attributes(*attributes) attributes.each do |attribute| define_method("t_#{attribute}") do lang = I18n.locale.to_s.split("-").first send("#{attribute}_#{lang}") end end end alias_method :translates_attribute, :translates_attributes end end