Skip to content

Commit

Permalink
[rails6] replace alias_method_chain
Browse files Browse the repository at this point in the history
While using the `Module.prepend` approach is probably the correct way to
do this, the way that this class is defined is pretty gross, so I would
rather avoid trying to deal with that and simply replicate the
functionality `alias_method_chain` provided by doing two `alias_method`
calls.

This is a Gem the probably should just die anyway, so I am not terribly
bothered by the hack...
  • Loading branch information
NickLaMuro committed Sep 30, 2020
1 parent 03dbd86 commit 417da52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/jquery-rjs/rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def render_with_update(options = {}, locals = {}, &block)
render_without_update(options, locals, &block)
end
end

alias_method_chain :render, :update
end

alias_method :render_without_update, :render
alias_method :render, :render_with_update
end
3 changes: 2 additions & 1 deletion lib/jquery-rjs/selector_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ def response_from_page_with_rjs
response_from_page_without_rjs
end
end
alias_method_chain :response_from_page, :rjs
alias_method :response_from_page_without_rjs, :response_from_page
alias_method :response_from_page, :response_from_page_with_rjs

# Unescapes a RJS string.
def unescape_rjs(rjs_string)
Expand Down

0 comments on commit 417da52

Please sign in to comment.