Agile Web Development with Rails, Edition 4

26.3 Pagination 26.1.4 JQuery

26.2 HAML

<"Your Pragmatic Catalog"> expected but was
<"NameError in\n  Store#index">.

Traceback:
  /home/rubys/git/awdwr/edition4/checkdepot.rb:491
edit Gemfile
bundle install --local
Resolving dependencies...
Using rake (10.1.1)
Using abstract (1.0.0)
Using activesupport (3.0.20) from source at /home/rubys/git/rails
Using builder (2.1.2)
Using i18n (0.5.3)
Using activemodel (3.0.20) from source at /home/rubys/git/rails
Using erubis (2.6.6)
Using rack (1.2.8)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.38)
Using actionpack (3.0.20) from source at /home/rubys/git/rails
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.2.20)
Using actionmailer (3.0.20) from source at /home/rubys/git/rails
Using braintree (2.28.0)
Using activemerchant (1.10.0)
Using arel (2.0.10)
Using activerecord (3.0.20) from source at /home/rubys/git/rails
Using activeresource (3.0.20) from source at /home/rubys/git/rails
Using bundler (1.5.2)
Using highline (1.6.20)
Using net-ssh (2.8.0)
Using net-scp (1.1.2)
Using net-sftp (2.1.2)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.15.5)
Using tilt (2.0.0)
Using haml (4.0.5)
Using json (1.8.1)
Using mysql (2.9.1)
Using rdoc (3.12.2)
Using thor (0.14.6)
Using railties (3.0.20) from source at /home/rubys/git/rails
Using rails (3.0.20) from source at /home/rubys/git/rails
Using rvm-capistrano (1.5.1)
Using sqlite3 (1.3.8)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
rails runner "require 'haml'"
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

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 /

NameError in Store#index

Showing /home/rubys/git/awdwr/edition4/work-187-30/depot/app/views/store/index.html.haml where line #4 raised:

uninitialized constant I18n::RESERVED_KEYS

Extracted source (around line #4):

1: - if notice
2:   %p#notice= notice
3: 
4: %h1= t('.title_html')
5: - @products.each do |product|
6:   .entry
7:     = image_tag(product.image_url)

Rails.root: /home/rubys/git/awdwr/edition4/work-187-30/depot

Application Trace | Framework Trace | Full Trace
app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1883226003_70061751111460_0'

Request

Parameters:

None

Show session dump

Show env dump

Response

Headers:

None

26.3 Pagination 26.1.4 JQuery