Class: Iron::Entry

Inherits:
ApplicationRecord show all
Includes:
ContentAssignable, DeepValidation, Exportable, Importable, Presentable, Schemable, Searchable, Titlable, WebPublishable, InstanceScoped
Defined in:
app/models/iron/entry.rb,
app/models/iron/entry/deep_validation.rb

Defined Under Namespace

Modules: ContentAssignable, DeepValidation, Exportable, Importable, Presentable, Schemable, Searchable, Titlable, WebPublishable

Constant Summary

Constants included from Searchable

Searchable::SEARCH_CONTENT_LIMIT

Instance Method Summary collapse

Methods included from Titlable

#title

Methods included from Searchable

#reindex

Methods included from WebPublishable

#path, #use_as_index, #use_as_index=, #web_title

Methods included from Presentable

#attributes, #find_field_for_presentation

Methods included from InstanceScoped

#instance, #to_global_id, #to_signed_global_id

Methods included from Exportable

#export_attachment_path, #export_attachments, #export_attributes, #export_json

Methods included from ContentAssignable

#assign_content, #content_errors

Instance Method Details

#find_or_build_field(definition, locale) ⇒ Object



12
13
14
15
16
# File 'app/models/iron/entry.rb', line 12

def find_or_build_field(definition, locale)
  field = fields.find { |f| f.definition == definition && f.locale == locale } ||
          fields.build(type: definition.field_type, definition:, locale:)
  field
end