lib/administrate/base_dashboard.rb in administrate-0.5.0 vs lib/administrate/base_dashboard.rb in administrate-0.6.0
- old
+ new
@@ -50,9 +50,20 @@
def display_resource(resource)
"#{resource.class} ##{resource.id}"
end
+ def association_includes
+ association_classes = [Field::HasMany, Field::HasOne, Field::BelongsTo]
+
+ collection_attributes.map do |key|
+ field = self.class::ATTRIBUTE_TYPES[key]
+
+ next key if association_classes.include?(field)
+ key if association_classes.include?(field.try :deferred_class)
+ end.compact
+ end
+
private
def attribute_not_found_message(attr)
"Attribute #{attr} could not be found in #{self.class}::ATTRIBUTE_TYPES"
end