Test Your Knowledge
Quiz
How much JavaScript do you need to write to create Ajax applications from Rails?
What is the difference between
form_tagandform_remote_tag?What helper method lets you place identifiers on data on a per-record basis?
How do you include the Prototype and Script.aculo.us JavaScript libraries in your pages?
Which object lets you create JavaScript using Ruby in RJS pages?
Answers
You can create a basic Ajax application using Rails without writing any JavaScript directly. If you want to do complex things in the browser, though, you may find it easier to write some JavaScript.
form_tagissues an HTTP request that replaces all the content in the browser.form_remote_tagissues an HTTP request, but processes the results with JavaScript rather than having the browser render them directly.The
dom_idhelper lets you put identifiers into HTML documents and reference them from your server code as well.Putting
<%= javascript_include_tag :defaults %>into a view will load the Prototype and Script.aculo.us JavaScript libraries into the resulting HTML document.The
pageobject is the bridge between Ruby and JavaScript code.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access