Class: Wallaby::ActiveRecord::ModelDecorator::FieldsBuilder::AssociationBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/adapters/wallaby/active_record/model_decorator/fields_builder/association_builder.rb

Overview

To build the metadata for associations fields

Instance Method Summary collapse

Instance Method Details

#update(metadata, reflection) ⇒ Object

Update the metadata

Parameters:

  • metadata (Hash)
  • reflection (ActiveRecord::Reflection)


12
13
14
15
16
17
18
19
# File 'lib/adapters/wallaby/active_record/model_decorator/fields_builder/association_builder.rb', line 12

def update(, reflection)
  type = reflection.macro
  [:is_association] = true
  [:sort_disabled] = true
  [:is_through] = through?(reflection)
  [:has_scope] = scope?(reflection)
  [:foreign_key] = foreign_key_for(reflection, type)
end