html. It’s most commonly used with rjs templates, although you could of
There’s nothing wrong with having it in the helper file, but typically
you don’t want it in a rhtml template (since it won’t be evaluated). So
instead of callng insert_html … You should just do the render itself
in the right place. (ie if menu just does render :partial =>
‘navigation’ you should be ok
I can’t figure out is how to
use a rjs template in this situation. Having it in the helper file
only way it works , yet for some reason, it’s rendering the lines of
what is intended to be shown.
render :update and RJS templates do exactly this. They render
but they dont apply any tags because what they are
intentionally meant for are AJAX calls. and that AJAX Object evaluates
If you use a RJS template in a helper, it wont be evaluated as there’s
I still cant get a clear pitcure of what you actually trying to do (you
say it doesn’t completely refresh … spounds like AJAX … where’s the
AJAX call then?), sure render :partial won’t work? did you try it?
layout calls helper “menu” -> menu calls render :update > render
:update call render :partial> partial gets rendered … but IN
why should this not work:
layout calls helper “menu” -> menu calls render :partial -> partial
gets render … in HTML (which is what you want obviously …)
rendering the navigation partial is fine.
I think I understand what you’re trying to do but, as was noted earlier,
I think you may be mixing up two types of operation.
calling the helper from within your rhtml is evaluated when the whole
page is reloaded. The helper called render :update, which just returns
into your page.
using RJS to update the page. From within the RHTML, use prototype
to trigger an ajax call to some action. That action would call render
:update (and the insert_html etc). That would return a big string of
You can think of 1) as html-page-compile-time and 2) as
render :partial returns html which is included at compile time.
Since helpers are ‘compile-time’ you need to use partials and not