2024-07-15 14:31:54 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-07-15 02:19:27 +02:00
|
|
|
class ApplicationRecord < ActiveRecord::Base
|
|
|
|
|
primary_abstract_class
|
2024-09-05 22:54:38 +02:00
|
|
|
|
|
|
|
|
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
|
2024-07-15 02:19:27 +02:00
|
|
|
end
|