Class: Refinery::TranslatedFieldPresenter

Inherits:
Object
  • Object
show all
Defined in:
core/app/presenters/refinery/translated_field_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ TranslatedFieldPresenter



3
4
5
# File 'core/app/presenters/refinery/translated_field_presenter.rb', line 3

def initialize(record)
  @record = record
end

Instance Method Details

#call(field) ⇒ Object



7
8
9
10
# File 'core/app/presenters/refinery/translated_field_presenter.rb', line 7

def call(field)
  record.send(field).presence ||
    record.translations.detect {|t| t.send(field).present?}.send(field)
end