O'Reilly logo

Learning Rails: Live Edition by Edd Dumbill, Simon St. Laurent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Test Your Knowledge

Quiz

  1. How much JavaScript do you need to write to create Ajax applications from Rails?

  2. What is the difference between form_tag and form_remote_tag?

  3. What helper method lets you place identifiers on data on a per-record basis?

  4. How do you include the Prototype and Script.aculo.us JavaScript libraries in your pages?

  5. Which object lets you create JavaScript using Ruby in RJS pages?

Answers

  1. 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.

  2. form_tag issues an HTTP request that replaces all the content in the browser. form_remote_tag issues an HTTP request, but processes the results with JavaScript rather than having the browser render them directly.

  3. The dom_id helper lets you put identifiers into HTML documents and reference them from your server code as well.

  4. Putting <%= javascript_include_tag :defaults %> into a view will load the Prototype and Script.aculo.us JavaScript libraries into the resulting HTML document.

  5. The page object is the bridge between Ruby and JavaScript code.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required