Skip to content

Commit

Permalink
Merge pull request #251 from github/rails-master-short-circuit
Browse files Browse the repository at this point in the history
bypass monkey patch on Rails 6.1 builds.
  • Loading branch information
joelhawksley authored Mar 9, 2020
2 parents 5970b11 + b10933e commit bb7070a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# master

* Bypass monkey patch on Rails 6.1 builds.

*Joel Hawksley*

* Make `ActionView::Helpers::TagHelper` available in Previews

def with_html_content
Expand Down
2 changes: 1 addition & 1 deletion lib/view_component/render_monkey_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module ViewComponent
module RenderMonkeyPatch # :nodoc:
def render(options = {}, args = {}, &block)
if options.respond_to?(:render_in)
if options.respond_to?(:render_in) && Rails.version.to_f < 6.1
options.render_in(self, &block)
elsif options.is_a?(Class) && options < ActionView::Component::Base
ActiveSupport::Deprecation.warn(
Expand Down
2 changes: 1 addition & 1 deletion lib/view_component/rendering_monkey_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module ViewComponent
module RenderingMonkeyPatch # :nodoc:
def render(options = {}, args = {})
if options.respond_to?(:render_in)
if options.respond_to?(:render_in) && Rails.version.to_f < 6.1
self.response_body = options.render_in(self.view_context)
else
super
Expand Down

0 comments on commit bb7070a

Please sign in to comment.