pass proxy_association to scopes in rails 3
Change-Id: I6f0b7bfc5ab9d9c73287e8b51f522406133a9091 Reviewed-on: https://gerrit.instructure.com/30041 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
d67913fde9
commit
406179c228
|
@ -1073,6 +1073,16 @@ unless CANVAS_RAILS2
|
|||
ActiveRecord::Associations::CollectionProxy.class_eval do
|
||||
delegate :with_each_shard, :to => :scoped
|
||||
end
|
||||
|
||||
ActiveRecord::Associations::CollectionAssociation.class_eval do
|
||||
def scoped
|
||||
scope = super
|
||||
proxy_association = self
|
||||
scope.extending do
|
||||
define_method(:proxy_association) { proxy_association }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
|
||||
|
|
Loading…
Reference in New Issue