Class: Refinery::TranslatedFieldPresenter
- Inherits:
-
Object
- Object
- Refinery::TranslatedFieldPresenter
- Defined in:
- app/presenters/refinery/translated_field_presenter.rb
Instance Method Summary collapse
- #call(field) ⇒ Object
-
#initialize(record) ⇒ TranslatedFieldPresenter
constructor
A new instance of TranslatedFieldPresenter.
Constructor Details
#initialize(record) ⇒ TranslatedFieldPresenter
Returns a new instance of TranslatedFieldPresenter.
3 4 5 |
# File '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 '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 |