Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify association decoration

We don't actually need to reflect on the association because we have
already fetched the associated object - we can just infer the
appropriate decorator from it directly.
  • Loading branch information...
commit 609123f1cc3f6518c93fb18f3d62572ea0bec360 1 parent f0a1be3
@haines haines authored
Showing with 1 addition and 13 deletions.
  1. +1 −13 lib/draper/decorated_association.rb
View
14 lib/draper/decorated_association.rb
@@ -47,21 +47,9 @@ def decorator_class
options[:with] = :infer
Draper::CollectionDecorator
else
- "#{association_class}Decorator".constantize
+ undecorated.decorator_class
end
end
- def association_class
- if !options[:polymorphic] && association_reflection
- association_reflection.klass
- else
- undecorated.class
- end
- end
-
- def association_reflection
- @reflection ||= source.class.reflect_on_association(association) if source.class.respond_to?(:reflect_on_association)
- end
-
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.