If I wanted to make an RJS template generate something, how would I go
about
doing that? Like, right now you have page.insert_html, etc., but let’s
say
I wanted to define my_page.insert_html, and I want it to generate
different
code. How would I do that?
If I wanted to make an RJS template generate something, how would I go
about
doing that? Like, right now you have page.insert_html, etc., but let’s
say
I wanted to define my_page.insert_html, and I want it to generate
different
code. How would I do that?
If you want to override one the original methods, you can use
alias_method_chain.
class ActionView::Helpers::PrototypeHelper::JavaScriptGenerator
def alert_with_foo(message)
alert_without_foo(“#{message} Foo!”)
end
alias_method_chain :alert, :foo
end