This is my understanding of html and browsers. On the server, html is
plain text. When the browser sends request to server to fetch a
document, if the file is not already in html format, perhaps instead
in an rb file, ruby or whatever the server-side language of choice
converts the file to html and sends it to the browser. But what if we
have a partial thats not included in the document that is fetched?
Does it remain on the server as plain text and, therefore, is not part
raise an exception of undefined object. Now one technique is to use
request to the server via ajax, and ruby handles the request. Now if
the response is to send the object back to the browser, specifically
like this: render :text => ret_object.to_json. Now what if that
returned object hash (that utlimately gets converted to json before we
send response back to client) included this: returned_object[:data]
[:view] = render_to_string :partial => ‘/home/my_table’. Note that
my_table is a partial in home directory. When we grab the response
tree: $(’#my_table .my_content’).append(resp.data.view);. Now that
My question is does that partial remain plain text on server until
it is explicitly loaded on the document that was fetched from server.
What exactly is the point of render_to_string? Why can’t we just
use “render”? Or do we need to use render_to_string in order to use
the jquery append method, for example, when appending it to the DOM?
thanks for response