Class: Krant::TranslatedBroadcastMessage::Query Private

Inherits:
Object
  • Object
show all
Defined in:
app/models/krant/translated_broadcast_message.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#activeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/krant/translated_broadcast_message.rb', line 16

def active
  scope = BroadcastMessage.active

  scope = with_translation(scope, 'current_locale', I18n.locale)
  scope = with_translation(scope, 'default_locale', I18n.default_locale)

  scope.map do |broadcast_message|
    TranslatedBroadcastMessage.new(broadcast_message.current_locale_text.presence ||
                                   broadcast_message.default_locale_text)
  end
end