Agile Web Development with Rails, Edition 5

27.3 Pagination 27.1 Active Merchant

27.2 HAML

edit Gemfile
gem 'activemerchant', '~> 1.58'
gem 'haml', '~> 4.0'
bundle install --local
Resolving dependencies...
Using rake 12.0.0
Using pg 0.19.0
Using ffi 1.9.18
Using concurrent-ruby 1.0.5
Using i18n 0.8.4
Using minitest 5.8.5
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 2.0.3
Using nio4r 2.1.0
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.4
Using bundler 1.15.1
Using method_source 0.8.2
Using thor 0.19.4
Using sqlite3 1.3.13
Using mysql2 0.4.6
Using puma 3.9.0
Using sass 3.4.24
Using tilt 2.0.7
Using execjs 2.7.0
Using coffee-script-source 1.12.2
Using turbolinks-source 5.0.3
Using multi_json 1.12.1
Using bcrypt 3.1.11
Using net-ssh 4.1.0
Using byebug 9.0.6
Using bindex 0.5.0
Using queue_classic 3.2.0.RC1 from source at `/home/rubys/git/queue_classic`
Using rb-inotify 0.9.9 from source at `/home/rubys/git/rb-inotify`
Using i18n-js 3.0.0
Using tzinfo 1.2.3
Using nokogiri 1.7.2
Using rack-test 0.6.3
Using sprockets 3.7.1
Using websocket-driver 0.6.5
Using mime-types 3.1
Using haml 4.0.7
Using uglifier 3.2.0
Using coffee-script 2.4.1
Using turbolinks 5.0.1
Using net-scp 1.2.1
Using activesupport 5.0.3 from source at `/home/rubys/git/rails`
Using loofah 2.0.3
Using mail 2.6.5
Using sshkit 1.13.1
Using rails-dom-testing 2.0.3
Using globalid 0.4.0
Using activemodel 5.0.3 from source at `/home/rubys/git/rails`
Using jbuilder 2.6.4
Using spring 2.0.2
Using activemerchant 1.66.0
Using rails-html-sanitizer 1.0.3
Using airbrussh 1.2.0
Using activejob 5.0.3 from source at `/home/rubys/git/rails`
Using activerecord 5.0.3 from source at `/home/rubys/git/rails`
Using actionview 5.0.3 from source at `/home/rubys/git/rails`
Using capistrano 3.8.1
Using activemodel-serializers-xml 1.0.1
Using actionpack 5.0.3 from source at `/home/rubys/git/rails`
Using capistrano-bundler 1.2.0
Using capistrano-rvm 0.1.2
Using capistrano-passenger 0.2.0
Using actioncable 5.0.3 from source at `/home/rubys/git/rails`
Using actionmailer 5.0.3 from source at `/home/rubys/git/rails`
Using railties 5.0.3 from source at `/home/rubys/git/rails`
Using sprockets-rails 3.2.0
Using capistrano-rails 1.2.3
Using coffee-rails 4.2.2
Using jquery-rails 4.3.1
Using jquery-ui-rails 6.0.1
Using web-console 3.5.1 from source at `/home/rubys/git/web-console`
Using rails 5.0.3 from source at `/home/rubys/git/rails`
Using sass-rails 5.0.6
Bundle complete! 26 Gemfile dependencies, 77 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
rails runner "require 'haml'"

Restart the server.

cat app/views/store/index.html.erb
<p id="notice"><%= notice %></p>
 
<h1><%= t('.title_html') %></h1>
 
<% cache @products do %>
  <% @products.each do |product| %>
    <% cache product do %>
      <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, locale: I18n.locale),
            remote: true %>
        </div>
      </div>
    <% end %>
  <% end %>
<% end %>
rm app/views/store/index.html.erb
edit app/views/store/index.html.haml
%p#notice= notice
 
%h1= t('.title_html')
 
- cache @products do
  - @products.each do |product|
    - cache product do
      .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, locale: I18n.locale),
            remote: true
get /

Your Pragmatic Catalog

Dcbang

Rails, Angular, Postgres, and Bootstrap

Powerful, Effective, and Efficient Full-Stack Web Development As a Rails developer, you care about user experience and performance, but you also want simple and maintainable code. Achieve all that by embracing the full stack of web development, from styling with Bootstrap, building an interactive user interface with AngularJS, to storing data quickly and reliably in PostgreSQL. Take a holistic view of full-stack development to create usable, high-performing applications, and learn to use these technologies effectively in a Ruby on Rails environment.

$45.00
Adrpo

Ruby Performance Optimization

Why Ruby Is Slow, and How to Fix It You don’t have to accept slow Ruby or Rails performance. In this comprehensive guide to Ruby optimization, you’ll learn how to write faster Ruby code—but that’s just the beginning. See exactly what makes Ruby and Rails code slow, and how to fix it. Alex Dymo will guide you through perils of memory and CPU optimization, profiling, measuring, performance testing, garbage collection, and tuning. You’ll find that all those “hard” things aren’t so difficult after all, and your code will run orders of magnitude faster.

$46.00
7apps

Seven Mobile Apps in Seven Weeks

Native Apps, Multiple Platforms Answer the question “Can we build this for ALL the devices?” with a resounding YES. This book will help you get there with a real-world introduction to seven platforms, whether you’re new to mobile or an experienced developer needing to expand your options. Plus, you’ll find out which cross-platform solution makes the most sense for your needs.

$26.00

27.3 Pagination 27.1 Active Merchant