I want a method in app/controllers/application.rb that can
prepend/append text to whatever template gets rendered. Of course I
can’t call render twice w/o getting a double render error, so is this
I want to redirect after a delay using a meta refresh. Here’s what I’ve
def redirect_after_delay (url, delay)
@redirect_delay = delay
@redirect_url = url
app/views/layouts/application.html.erb<%= yield :refresh_tag %> <%= yield %>
So then if I want to add a redirect-after-delay, I add the following to
- my controller and 2) the action’s view:
redirect_after_delay ‘http://www.google.com’, 3 if some_condition
<% content_for :refresh_tag do %><% end %>
Please wait while you are redirected...
Since the content_for block never changes, would be nice to just call
something from the redirect_after_delay method to add it to whatever
template is going to be rendered.