Class: CollectionWithFields

Inherits:
Administrate::Page::Collection
  • Object
show all
Defined in:
lib/administrate/field/has_many_with_fields.rb

Instance Method Summary collapse

Instance Method Details

#attribute_typesObject



34
35
36
37
# File 'lib/administrate/field/has_many_with_fields.rb', line 34

def attribute_types
  dashboard.attribute_types_for(attribute_names)
  dashboard.attribute_types_for(selected_attribute_names)
end

#attributes_for(resource) ⇒ Object



28
29
30
31
32
# File 'lib/administrate/field/has_many_with_fields.rb', line 28

def attributes_for(resource)
  selected_attribute_names.map do |attr_name|
    attribute_field(dashboard, resource, attr_name, :index)
  end
end

#selected_attribute_namesObject



39
40
41
# File 'lib/administrate/field/has_many_with_fields.rb', line 39

def selected_attribute_names
  Array(options[:fields] || attribute_names)
end