Agile Web Development with Rails, Edition 4
26.3 Pagination
26.1 Active Merchant
26.2 HAML
edit Gemfile
gem 'activemerchant'
gem 'haml', '~> 4.0'
bundle install
Using rake (10.0.3)
Using i18n (0.6.1)
Using minitest (4.6.1)
Using multi_json (1.6.1)
Using atomic (1.0.1)
Using thread_safe (0.1.0)
Using tzinfo (0.3.35)
Using activesupport (4.0.0.beta)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0.beta)
Using mime-types (1.21)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.5.3)
Using actionmailer (4.0.0.beta)
Using active_utils (1.0.5)
Using json (1.7.7)
Using money (5.1.1)
Using nokogiri (1.5.6)
Using activemerchant (1.31.0)
Using activemodel (4.0.0.beta)
Using activerecord-deprecated_finders (0.0.3)
Using arel (3.0.2.20120819075748)
Using activerecord (4.0.0.beta)
Using activeresource (4.0.0.beta)
Using bcrypt-ruby (3.0.1)
Using bundler (1.3.0.pre.8)
Using highline (1.6.15)
Using net-ssh (2.6.5)
Using net-scp (1.1.0)
Using net-sftp (2.1.1)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.14.2)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rdoc (3.12.1)
Using thor (0.17.0)
Using railties (4.0.0.beta)
Using coffee-rails (4.0.0.beta)
Using tilt (1.3.3)
Using haml (4.0.0)
Using hike (1.2.1)
Using jbuilder (1.0.2)
Using jquery-rails (2.2.1)
Using mysql2 (0.3.11)
Using sprockets (2.8.2)
Using sprockets-rails (2.0.0.rc2)
Using rails (4.0.0.beta)
Using sass (3.2.6)
Using sass-rails (4.0.0.beta)
Using sqlite3 (1.3.7)
Using turbolinks (1.0.0)
Using uglifier (1.3.0)
Updating files in vendor/cache
Could not find activesupport-4.0.0.beta.gem for installation
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>
<% cache ['store', Product.latest] do %>
<% @products.each do |product| %>
<% cache ['entry', product] do %>
<div class="entry">
<%= image_tag(product.image_url) %>
<h3><%= product.title %></h3>
<p><%= sanitize(product.description) %></p>
<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 %>
<% end %>
<% end %>
rm app/views/store/index.html.erb
edit app/views/store/index.html.haml
- if notice
%p#notice= notice
%h1= t('.title_html')
- cache ['store', Product.latest] do
- @products.each do |product|
- cache ['entry', product] do
.entry
= image_tag(product.image_url)
%h3= product.title
%p= 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 /
Pragmatic Bookshelf
Your Pragmatic Catalog
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.
Programming Ruby 1.9
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.
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.
26.3 Pagination
26.1 Active Merchant