app/models/concerns/maglev/translatable.rb in maglevcms-1.2.2 vs app/models/concerns/maglev/translatable.rb in maglevcms-1.3.0
- old
+ new
@@ -9,9 +9,13 @@
def translations_for(attr)
public_send("#{attr}_translations")
end
+ def translate_attr_in(attr, locale, source_locale)
+ translations_for(attr)[locale.to_s] ||= translations_for(attr)[source_locale.to_s]
+ end
+
class_methods do
def order_by_translated(attr, direction)
order(Arel.sql("#{attr}_translations->>'#{Maglev::I18n.current_locale}'") => direction)
end