Skip to content

Commit 444873e

Browse files
committed
Update include logic to prevent Rails 6 deprecation warning
Full credit for this patch goes to benningm at this PR: risuiowa#105 The original author has not merged this PR in 2 years, so I am making this patch as to not be a blocker for rails 6 projects
1 parent 4ddcea0 commit 444873e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/rails-jquery-autocomplete.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ module RailsJQueryAutocomplete
1010
end
1111
end
1212

13-
class ActionController::Base
14-
include RailsJQueryAutocomplete::Autocomplete
13+
if Rails::VERSION::MAJOR >= 6
14+
ActiveSupport.on_load(:action_controller_base) do
15+
ActionController::Base.send(
16+
:include,
17+
RailsJQueryAutocomplete::Autocomplete
18+
)
19+
end
20+
else
21+
ActionController::Base.send(:include, RailsJQueryAutocomplete::Autocomplete)
1522
end
1623

1724
require 'rails-jquery-autocomplete/formtastic'

0 commit comments

Comments
 (0)