a few minor Rails 5 fixes

Change-Id: I6236c2bc4ce31fbcf501dcf16ad537e56a2a555a
Reviewed-on: https://gerrit.instructure.com/95674
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2016-11-18 12:47:26 -07:00
parent 5c6fbf1595
commit abed5fc15c
4 changed files with 6 additions and 5 deletions

View File

@ -572,7 +572,7 @@ module ApplicationHelper
parts.join(t('#title_separator', ': '))
end
def cache(name = {}, options = nil, &block)
def cache(name = {}, options = {}, &block)
unless options && options[:no_locale]
name = name.cache_key if name.respond_to?(:cache_key)
name = name + "/#{I18n.locale}" if name.is_a?(String)

View File

@ -48,7 +48,7 @@ end
module ArbitraryStrongishParams
ANYTHING = Object.new.freeze
def initialize(attributes = nil)
def initialize(attributes = (CANVAS_RAILS4_2 ? nil : {}))
@anythings = {}.with_indifferent_access
super
end
@ -107,7 +107,7 @@ module ArbitraryStrongishParams
end
end
def convert_hashes_to_parameters(key, value, assign_if_converted=true)
def convert_hashes_to_parameters(key, value, *args)
return value if @anythings.key?(key)
super
end

View File

@ -288,7 +288,7 @@ module AuthenticationMethods
format.html {
store_location
flash[:warning] = I18n.t('lib.auth.errors.not_authenticated', "You must be logged in to access this page") unless request.path == '/'
redirect_to login_url(params.slice(:canvas_login, :authentication_provider))
redirect_to login_url(strong_params.permit(:canvas_login, :authentication_provider))
}
format.json { render_json_unauthorized }
end

View File

@ -5,7 +5,8 @@
#
module Canvas
module RequestForgeryProtection
def form_authenticity_token
def form_authenticity_token(form_options: {})
# to implement per-form CSRF, see https://github.com/rails/rails/commit/3e98819e20bc113343d4d4c0df614865ad5a9d3a
masked_authenticity_token
end