Ruby on Rails development from scratch (Windows) (13)-Orders (order)

Source: Internet
Author: User
Tags ruby on rails

In the last content, we wrote the checkout processing. This time we will show the cart and order on a page so that users can easily see their shopping when they place an order.

1. Modify the checkout.rhtml file, just add a code:

<%= error_messages_for ("order")%>
<%= render_component (: Action => "Display_cart")%>―― this sentence
<%= Stylesheet_link_tag "Scaffold", "Depot": Media => "All"%>

Click on the "Checkout" link on the Display_cart page to see that the checkout page has changed, as shown in the figure:

2. But we see that in the top right of the page, the checkout link also shows that we certainly want to remove it. Back to the code added above:

<%= render_component (: Action => "Display_cart")%>

Render_component is actually putting the entire Display_cart page on display, and now we're going to add parameters so that it can be differentiated between the Display_cart page and the checkout page.

On the checkout page, change the code added above to read:

<%= render_component (: Action => "Display_cart",:p arams => {: Context =>: Checkout})%>

You can see that we have added a context parameter.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.