Get HTML, XML, and JSON formatted views working for who_bought requests. Experiment with including the order information in the XML view by rendering @product.to_xml(:include => :orders). Do the same thing for JSON. Discuss


What happens if you click the “Checkout” button in the sidebar while the checkout screen is already displayed? Can you find a way to disable the button in this circumstance? (Hint: variables set in the controller are available in layouts and partials as well as in the directly rendered template.) Discuss


The list of possible payment types is currently stored as a constant in the Order class. Can you move this list into a database table? Can you still make validation work for the field? Discuss

George Says

I ran into below bizzar behavior, can anyone shed some light?


        # The only difference between below two is the space between "redirect_to"  and  "(store_url" 
        #format.html { redirect_to (store_url, :notice => 'Thank you for your order' ) }  #don't work??
        #format.html { redirect_to(store_url, :notice => 'Thank you for your order.') }   #works!!

### error in broswer
C:/wug/proj_RoR/depot/app/controllers/orders_controller.rb:63: syntax error, unexpected ',', expecting ')'
...t.html {redirect_to (store_url, :notice => 'Thank you for yo...
...                               ^
C:/wug/proj_RoR/depot/app/controllers/orders_controller.rb:63: syntax error, unexpected ')', expecting '}'
...=> 'Thank you for your order.') }  
...                               ^

Mike says

redirect_to(...) is a function call with the arguments enclosed in the parens.

redirect_to (...) is a function call with one argument. The argument is enclosed in parens, but is syntactically incorrect: (foo, bar) is not a legal expression.