Class: Locomotive::Wagon::ContentEntryWithOnlyRelationshipsDecorator
- Inherits:
-
ContentEntryDecorator
- Object
- Steam::Decorators::I18nDecorator
- ContentEntryDecorator
- Locomotive::Wagon::ContentEntryWithOnlyRelationshipsDecorator
- Defined in:
- lib/locomotive/wagon/decorators/content_entry_decorator.rb
Constant Summary
Constants inherited from ContentEntryDecorator
Locomotive::Wagon::ContentEntryDecorator::DEFAULT_ATTRIBUTES
Instance Attribute Summary
Attributes inherited from ContentEntryDecorator
#__base_path__, #__content_assets_pusher__
Instance Method Summary collapse
- #__attributes__ ⇒ Object
- #decorate_belongs_to_field(value) ⇒ Object
- #decorate_has_many_field(value) ⇒ Object
- #decorate_many_to_many_field(value) ⇒ Object
Methods inherited from ContentEntryDecorator
#_id, #_id=, #decorate_date_field, #decorate_date_time_field, #decorate_file_field, #decorate_json_field, #decorate_text_field, #initialize, #method_missing, #to_hash
Methods included from PersistAssetsConcern
#asset_io, #replace_with_content_assets!, #replace_with_content_assets_in_hash!
Methods included from ToHashConcern
#prepare_value_for_hash, #to_hash
Constructor Details
This class inherits a constructor from Locomotive::Wagon::ContentEntryDecorator
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::Wagon::ContentEntryDecorator
Instance Method Details
#__attributes__ ⇒ Object
90 91 92 |
# File 'lib/locomotive/wagon/decorators/content_entry_decorator.rb', line 90 def __attributes__ fields.associations.map { |f| f.name.to_sym } end |
#decorate_belongs_to_field(value) ⇒ Object
94 95 96 97 |
# File 'lib/locomotive/wagon/decorators/content_entry_decorator.rb', line 94 def decorate_belongs_to_field(value) return nil if value.nil? value._slug.try(:[], __locale__.to_s) end |
#decorate_has_many_field(value) ⇒ Object
111 112 113 |
# File 'lib/locomotive/wagon/decorators/content_entry_decorator.rb', line 111 def decorate_has_many_field(value) nil end |
#decorate_many_to_many_field(value) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/locomotive/wagon/decorators/content_entry_decorator.rb', line 99 def decorate_many_to_many_field(value) entries = value.all if entries.empty? nil elsif entries.size == 1 && entries.first == '' [nil] else entries.map { |entry| entry._slug.try(:[], __locale__) }.compact end end |