rails 5.1: fix several deprecation warnings
refs CORE-1196 * avoid calling saving in an after_save callback. things just get weird * enable logging of deprecation warnings in specs (so that you can use the log to figure out which spec caused it) Change-Id: I64804f7b02e4edee0650caa6346cc58bcbe69628 Reviewed-on: https://gerrit.instructure.com/144667 Tested-by: Jenkins Reviewed-by: Rob Orton <rob@instructure.com> Product-Review: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
parent
9f36dde2c1
commit
f49d5c68b0
|
@ -65,7 +65,11 @@ class AssessmentQuestion < ActiveRecord::Base
|
|||
# this has to be in an after_save, because translate_links may create attachments
|
||||
# with this question as the context, and if this question does not exist yet,
|
||||
# creating that attachment will fail.
|
||||
translate_links if self.saved_change_to_question_data? && !@skip_translate_links
|
||||
if self.saved_change_to_question_data? && !@skip_translate_links
|
||||
AssessmentQuestion.connection.after_transaction_commit do
|
||||
translate_links
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.translate_links(ids)
|
||||
|
|
|
@ -47,8 +47,8 @@ environment_configuration(defined?(config) && config) do |config|
|
|||
# Raise exceptions instead of rendering exception templates
|
||||
config.action_dispatch.show_exceptions = true
|
||||
|
||||
# Print deprecation notices to the stderr
|
||||
config.active_support.deprecation = :stderr
|
||||
# Print deprecation notices to both stderr and the log
|
||||
config.active_support.deprecation = [:stderr, :log]
|
||||
|
||||
config.eager_load = false
|
||||
|
||||
|
|
|
@ -115,9 +115,11 @@ module Submittable
|
|||
submission_types: 'wiki_page'
|
||||
).update_all(workflow_state: 'deleted', updated_at: Time.now.utc)
|
||||
elsif self.assignment && @saved_by != :assignment
|
||||
self.clear_changes_information # needed to prevent an infinite loop in rails 4.2
|
||||
self.sync_assignment
|
||||
self.assignment.save
|
||||
# let the stack unwind before we sync this, so that we're not nesting callbacks
|
||||
self.class.connection.after_transaction_commit do
|
||||
self.sync_assignment
|
||||
self.assignment.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -617,6 +617,7 @@ describe Account do
|
|||
it "does not allow create_courses even to admins on site admin and children" do
|
||||
a = Account.site_admin
|
||||
a.settings = { :no_enrollments_can_create_courses => true }
|
||||
a.save!
|
||||
manual = a.manually_created_courses_account
|
||||
user_factory
|
||||
|
||||
|
|
Loading…
Reference in New Issue