Rendering a chosen RJS
June 22nd, 2006
Of course to render a rjs that has a name different from the controller method, we must use the :action specifier. For example we could have something like:
respond_to do |wants|
wants.html {render :partial=>"post", :object=>@post, :layout=>'posts'}
wants.js {render :action=>"remote_show"}
end
Although this is pretty obvious if you reason about it, you may need some time to get it. And on the net there aren’t easily accessible examples about it (or at least I found none).
It’s just a dirty trick.
Leave a Reply