Method: Effective::Resources::Attributes#model_attributes

Defined in:
app/models/effective/resources/attributes.rb

#model_attributes(all: false) ⇒ Object

All will include primary_key, created_at, updated_at and belongs_tos This is the attributes as defined by the effective_resources do .. end block { :name => [:string, { permitted: false }], … }



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'app/models/effective/resources/attributes.rb', line 58

def model_attributes(all: false)
  atts = (model ? model.attributes : {})

  if all # Probably being called by permitted_attributes
    primary_key_attribute
      .merge(belong_tos_attributes)
      .merge(has_manys_attributes)
      .merge(has_ones_attributes)
      .merge(effective_addresses_attributes)
      .merge(effective_assets_attributes)
      .merge(active_storage_attributes)
      .merge(atts)
  else  # This is the migrator. This should match table_attributes
    belong_tos_attributes.merge(atts.reject { |_, v| v[0] == :permitted_param })
  end
end