Skip to content

Commit

Permalink
use the association includes in the has_many resources as well
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorganIO authored and nickcharlton committed May 2, 2017
1 parent 16f184f commit 1ce0a5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/administrate/field/has_many.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def permitted_attribute
end

def resources(page = 1)
order.apply(data).page(page).per(limit)
resources = order.apply(data).page(page).per(limit)
includes.any? ? resources.includes(*includes) : resources
end

def more_than_limit?
Expand All @@ -47,6 +48,10 @@ def more_than_limit?

private

def includes
associated_dashboard.association_includes
end

def candidate_resources
if options.key?(:includes)
includes = options.fetch(:includes)
Expand Down

0 comments on commit 1ce0a5a

Please sign in to comment.