Rjs renders string or partial but not template or action


I have an rjs file. I only have one controller called called front. I
have views called “new_title.rhtml” and “_new_title.rhtml”

These work

page.replace_html ‘title’, ‘new title’
page.replace_html ‘title’, :partial => ‘new_title’
page.replace_html ‘title’, {:file=>“front/new_title”,

but these don’t

page.replace_html ‘title’, :template => ‘front/new_title’
page.replace_html ‘title’, :action => ‘new_title’
page.replace_html ‘title’, :controller => :front, :action => :new_title

This make alert boxes in my browser. “RJS error html has no
properties” and “Element.update(‘title’, null);”

Anyone know why the last three don’t work?


Did you ever get this answered? I have used RJS a ton but only
recently had the need to render a template from RJS (usually partials
are fine).

Anyone have the answer?


+1 for finding a good way to do this. I ended up using a partial (which
could be called by the rjs), and then having a template with a single
line in it calling the partial. Works fine, but has a bit of a smell

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs