Agile Web Development with Rails, Edition 4

26.3 Pagination 26.1 Active Merchant

26.2 HAML

edit Gemfile
bundle install --local
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using multi_json 1.11.0
Using activesupport 3.2.21 from source at /home/rubys/git/rails
Using builder 3.0.4
Using activemodel 3.2.21 from source at /home/rubys/git/rails
Using erubis 2.7.0
Using journey 1.0.4.20120614141756 from source at /home/rubys/git/journey
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.3
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.3
Using actionpack 3.2.21 from source at /home/rubys/git/rails
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 3.2.21 from source at /home/rubys/git/rails
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using activemerchant 1.49.0
Using arel 3.0.3.20131114190737 from source at /home/rubys/git/arel
Using tzinfo 0.3.44
Using activerecord 3.2.21 from source at /home/rubys/git/rails
Using activeresource 3.2.21 from source at /home/rubys/git/rails
Using bcrypt-ruby 3.0.1
Using bundler 1.9.9
Using highline 1.7.2
Using net-ssh 2.9.2
Using net-scp 1.2.1
Using net-sftp 2.1.2
Using net-ssh-gateway 1.2.0
Using capistrano 2.15.5
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using rack-ssl 1.3.4
Using json 1.8.2
Using rdoc 3.12.2
Using thor 0.19.1
Using railties 3.2.21 from source at /home/rubys/git/rails
Using coffee-rails 3.2.2 from source at /home/rubys/git/coffee-rails
Using haml 4.0.6
Using jquery-rails 3.1.2
Using jquery-ui-rails 5.0.5
Using mysql2 0.3.18
Using rails 3.2.21 from source at /home/rubys/git/rails
Using rvm-capistrano 1.5.6
Using sass 3.4.14
Using sass-rails 3.2.6 from source at /home/rubys/git/sass-rails
Using sqlite3 1.3.10
Using uglifier 2.7.1
Bundle complete! 14 Gemfile dependencies, 54 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
rails runner "require 'haml'"

Restart the server.

cat app/views/store/index.html.erb
<% if notice %>
<p id="notice"><%= notice %></p>
<% end %>
 
<h1><%= t('.title_html') %></h1>
 
<% @products.each do |product| %>
  <div class="entry">
    <%= image_tag(product.image_url) %>
    <h3><%= product.title %></h3>
    <%= sanitize(product.description) %>
    <div class="price_line">
      <span class="price"><%= number_to_currency(product.price) %></span>
          <%= button_to t('.add_html'), line_items_path(product_id: product),
            remote: true %>
    </div>
  </div>
<% end %>
rm app/views/store/index.html.erb
edit app/views/store/index.html.haml
- if notice
  %p#notice= notice
 
%h1= t('.title_html')
- @products.each do |product|
  .entry
    = image_tag(product.image_url)
    %h3= product.title
    = sanitize(product.description)
    .price_line
      %span.price= number_to_currency(product.price)
      = button_to t('.add_html'), line_items_path(product_id: product),
        remote: true
get /

Your Pragmatic Catalog

Cs

CoffeeScript

CoffeeScript is JavaScript done right. It provides all of JavaScript's functionality wrapped in a cleaner, more succinct syntax. In the first book on this exciting new language, CoffeeScript guru Trevor Burnham shows you how to hold onto all the power and flexibility of JavaScript while writing clearer, cleaner, and safer code.

$31.00
Ruby

Programming Ruby 1.9 & 2.0

Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox.

$49.95
Rtp

Rails Test Prescriptions

Rails Test Prescriptions is a comprehensive guide to testing Rails applications, covering Test-Driven Development from both a theoretical perspective (why to test) and from a practical perspective (how to test effectively). It covers the core Rails testing tools and procedures for Rails 2 and Rails 3, and introduces popular add-ons, including Cucumber, Shoulda, Machinist, Mocha, and Rcov.

$34.95

26.3 Pagination 26.1 Active Merchant