fix reflection merges

options[:conditions] is nil

also fixes for rails 4.2

refs #CNVS-26056

Change-Id: Iae3b456c8b535f41f4e61528bf0d2f4233a4a2b4
Reviewed-on: https://gerrit.instructure.com/70381
Tested-by: Jenkins
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:
James Williams 2016-01-15 11:28:44 -07:00
parent d36378f55d
commit 992349ee0e
2 changed files with 2 additions and 2 deletions

View File

@ -1005,7 +1005,7 @@ class Assignment < ActiveRecord::Base
students = group.users
.joins(:enrollments)
.where(:enrollments => { :course_id => self.context})
.where(Course.reflections[:student_enrollments].options[:conditions])
.merge(Course.instance_exec(&Course.reflections[CANVAS_RAILS4_0 ? :student_enrollments : 'student_enrollments'].scope).only(:where))
.order("users.id") # this helps with preventing deadlock with other things that touch lots of users
.uniq
.to_a

View File

@ -2159,7 +2159,7 @@ class User < ActiveRecord::Base
group_rows = pluck_global_id_rows(
GroupMembership.joins(:group).
where(User.reflections[:current_group_memberships].options[:conditions]).
merge(User.instance_exec(&User.reflections[CANVAS_RAILS4_0 ? :current_group_memberships : 'current_group_memberships'].scope).only(:where)).
where(user_id: users).
select([:user_id, :group_id]).
uniq)