various rails 6 fixes

Change-Id: I9a2da0fe619170e6a297ad5d1b9dd3e11daf3782
Reviewed-on: https://gerrit.instructure.com/206054
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
Cody Cutrer 2019-08-19 09:53:58 -06:00
parent aa5811bdff
commit 4f267c41b9
6 changed files with 35 additions and 11 deletions

4
.gitignore vendored
View File

@ -19,7 +19,7 @@
/config/*.yml
/config/environments/*-local.rb
/config/locales/generated/
/config/RAILS5_2
/config/RAILS6_0
/coverage/
/coverage-js/
/db/schema.rb
@ -27,7 +27,7 @@
/db/*sql
/exports/
Gemfile.lock
Gemfile.lock.52
Gemfile.lock.next
/log/
mkmf.log
/node_modules

View File

@ -19,7 +19,7 @@ if CANVAS_RAILS5_2
gem 'rails', '5.2.3'
gem 'loofah', '2.2.3'
else
gem 'rails', '6.0.0.rc2'
gem 'rails', '6.0.0'
end
gem 'rack', '2.0.6'
@ -37,7 +37,7 @@ gem 'active_model_serializers', '0.9.0alpha1',
gem 'authlogic', '5.0.2'
gem 'scrypt', '3.0.6'
gem 'active_model-better_errors', '1.6.7', require: 'active_model/better_errors'
gem 'switchman', '1.14.5'
gem 'switchman', '1.14.6'
gem 'open4', '1.3.4', require: false
gem 'folio-pagination', '0.0.12', require: 'folio/rails'
# for folio, see the folio README
@ -62,7 +62,7 @@ gem 'brotli', '0.2.3', require: false
gem 'canvas_connect', '0.3.11'
gem 'adobe_connect', '1.0.8', require: false
gem 'canvas_webex', '0.17'
gem 'inst-jobs', '0.15.11'
gem 'inst-jobs', '0.15.13'
gem 'rufus-scheduler', '3.4.2', require: false
gem 'et-orbi', '1.0.8', require: false
gem 'switchman-inst-jobs', '1.3.5'
@ -133,7 +133,7 @@ gem 'academic_benchmarks', '0.0.11', require: false
gem 'graphql', '1.9.7'
gem 'graphql-batch', '0.4.1'
gem 'prawn-rails', '1.2.0'
gem 'prawn-rails', '1.3.0'
gem 'activesupport-suspend_callbacks', path: 'gems/activesupport-suspend_callbacks'
gem 'acts_as_list', path: 'gems/acts_as_list'

View File

@ -1534,7 +1534,7 @@ class Enrollment < ActiveRecord::Base
course_id: course,
user_id: user,
type: Array.wrap(types)
).where.not(id: id, workflow_state: :deleted)
).where.not(id: id).where.not(workflow_state: :deleted)
end
def remove_user_as_final_grader?

View File

@ -1446,7 +1446,13 @@ end
module UnscopeCallbacks
def run_callbacks(*args)
scope = self.class.all.klass.unscoped
unless CANVAS_RAILS5_2
# in rails 6.1, we can get rid of this entire monkeypatch
scope = self.class.current_scope&.clone || self.class.default_scoped
scope = scope.klass.unscoped
else
scope = self.class.all.klass.unscoped
end
scope.scoping { super }
end
end
@ -1615,8 +1621,22 @@ module TableRename
end
end
module DefeatInspectionFilterMarshalling
def inspect
result = super
@inspection_filter = nil
result
end
def pretty_print(_pp)
super
@inspection_filter = nil
end
end
ActiveRecord::ConnectionAdapters::SchemaCache.prepend(TableRename)
ActiveRecord::Base.prepend(DefeatInspectionFilterMarshalling)
ActiveRecord::Base.prepend(Canvas::CacheRegister::ActiveRecord::Base)
ActiveRecord::Base.singleton_class.prepend(Canvas::CacheRegister::ActiveRecord::Base::ClassMethods)
ActiveRecord::Relation.prepend(Canvas::CacheRegister::ActiveRecord::Relation)

View File

@ -190,8 +190,12 @@ class ContentZipper
@portfolio = @portfolio
@static_attachments = static_attachments
@submissions_hash = submissions_hash
av = ActionView::Base.new()
av.view_paths = ActionController::Base.view_paths
if CANVAS_RAILS5_2
av = ActionView::Base.new()
av.view_paths = ActionController::Base.view_paths
else
av = ActionView::Base.with_view_paths(ActionController::Base.view_paths)
end
av.extend TextHelper
res = av.render(:partial => "eportfolios/static_page", :locals => {:page => page, :portfolio => portfolio, :static_attachments => static_attachments, :submissions_hash => submissions_hash})
res

View File

@ -907,7 +907,7 @@ RSpec.configure do |config|
scope = klass.order("id DESC").limit(records.size)
if return_type == :record
records = scope.to_a.reverse
if Bullet.enable?
if CANVAS_RAILS5_2 && Bullet.enable?
records.each { |record| Bullet::Detector::NPlusOneQuery.add_impossible_object(record) }
end
records