a11yist/app/models/application_record.rb
david 63fc206c27
Some checks failed
/ Run tests (push) Successful in 8m56s
/ Run system tests (push) Failing after 1h0m48s
/ Build, push and deploy image (push) Successful in 7m47s
A lot :)
2024-09-05 22:54:38 +02:00

18 lines
435 B
Ruby

# 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