Skip to Content
Agile Web Development with Rails 6
book

Agile Web Development with Rails 6

by Sam Ruby, David B. Copeland, Dave Thomas
February 2020
Intermediate to advanced
496 pages
12h 36m
English
Pragmatic Bookshelf
Content preview from Agile Web Development with Rails 6

Iteration K3: Translating Checkout

Now we’re entering the home stretch. The new order page is next:

 <section class=​"depot_form"​>
» <h1>​<%=​ t(​'.legend'​) ​%>​</h1>
 <%=​ render ​'form'​, ​order: ​@order ​%>
 </section>
 
 <%=​ javascript_pack_tag(​"pay_type"​) ​%>

Here’s the form that’s used by this page:

 <%=​ form_with(​model: ​order, ​local: ​​true​) ​do​ |form| ​%>
 <%​ ​if​ order.​errors​.​any?​ ​%>
  <div id=​"error_explanation"​>
  <h2>​<%=​ pluralize(order.​errors​.​count​, ​"error"​) ​%>
  prohibited this order from being saved:</h2>
 
  <ul>
 <%​ order.​errors​.​full_messages​.​each​ ​do​ |message| ​%>
  <li>​<%=​ message ...
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.
Start your free trial

You might also like

Agile Web Development with Rails 5.1

Agile Web Development with Rails 5.1

Sam Ruby, David B. Copeland, Dave Thomas

Publisher Resources

ISBN: 9781680507522Errata Page