Skip to content

Commit

Permalink
Fixes #29470 - Rails 6 compatible template handler method
Browse files Browse the repository at this point in the history
ActionView::Template::Handlers changed the method signature for `call` in rails 6
  • Loading branch information
ezr-ondrej committed Apr 7, 2020
1 parent ba97002 commit a2e8571
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions config/initializers/rabl_init.rb
Expand Up @@ -55,9 +55,7 @@ module RablTemplateHandlerExt
# while initializing the engine.
# This allows us to find extension template from plugins
# that match the template name
def call(template)
source = template.source

def call(template, source)
%{ ::Rabl::Engine.new(#{source.inspect}, :template => '#{template.virtual_path}').
apply(self, assigns.merge(local_assigns)).
render }
Expand Down
12 changes: 12 additions & 0 deletions config/initializers/z_rails_5_compatibility.rb
@@ -0,0 +1,12 @@
module Foreman
module Rails5
module RablTemplateHandlerExt
def call(template, source = nil)
source ||= template.source
super(template, source)
end
end
end
end

ActionView::Template::Handlers::Rabl.singleton_class.prepend Foreman::Rails5::RablTemplateHandlerExt

0 comments on commit a2e8571

Please sign in to comment.