Task B: Catalog Display

Add a date and time to the sidebar. It doesn’t have to update: just show the value at the time the page was displayed. Discuss

Change the application so that clicking a book’s image will also invoke the add_to_cart action. (It’s OK, I know we haven’t written that action yet….) Hint: the first parameter to link_to is placed in the generated a tag, and the Rails helper image_tag constructs an HTML img tag. Look up image_tag in the Rails API documentation at http://api.rubyonrails.org, and include a call to it as the first parameter to a link_to call. Discuss

The full description of the number_to_currency helper method is.

number_to_currency(number, options = {})

Formats a number into a currency string. The options hash can be used to customize the for mat of the output. The number can contain a level of precision using the :precision key; default is 2 The currency type can be set using the :unit key; default is "$" The unit separator can be set using the :separator key; default is "." The delimiter can be set using the :delimiter key; default is ",".
#=> $1,234,567,890.50

#=> $1,234,567,890.51

number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "")
#=> £1234567890,50

Experiment with setting various options, and see the effect on your catalog listing. Discuss

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License