mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add support for Rails 6
Minor fixes to add Rails 6 support to Discourse, we now will boot with RAILS_MASTER=1, all specs pass Only one tiny deprecation left Largest change was the way ActiveModel:Errors changed interface a bit but there is a simple backwards compat way of working it
This commit is contained in:
@@ -10,9 +10,19 @@
|
||||
module ActiveRecord
|
||||
module AttributeMethods
|
||||
module ClassMethods
|
||||
# this is for Rails 5
|
||||
def enforce_raw_sql_whitelist(*args)
|
||||
return
|
||||
end
|
||||
|
||||
BLANK_ARRAY = [].freeze
|
||||
|
||||
# this patch just allows everyting in Rails 6
|
||||
def disallow_raw_sql!(args, permit: nil)
|
||||
# we may consider moving to https://github.com/rails/rails/pull/33330
|
||||
# once all frozen string hints are in place
|
||||
return BLANK_ARRAY
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
9
lib/freedom_patches/rails6.rb
Normal file
9
lib/freedom_patches/rails6.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# this is a quick backport of a new method introduced in Rails 6
|
||||
# to be removed after we upgrade to Rails 6
|
||||
if ! defined? ActionView::Base.with_view_paths
|
||||
class ActionView::Base
|
||||
class << self
|
||||
alias with_view_paths new
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user