small medium large xlarge

Generic-user-small
10 May 2015, 05:51
Vishal Deepak (3 posts)

On completing iteration F5, on clicking the image, each element count increases by 2?

index.html.erb

<% if notice %>
<p id="notice"><%= notice %></p>
<% end %>

<h1>Your Pragmatic Catalog </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>
				<%= sanitize(product.description)%>
				<div class="price_line">
					<span class="price"><%= number_to_currency(product.price)%></span>
					<%= button_to 'Add to Cart', lint_items_path(product_id: product),
					    remote: true %>
				</div>
			</div>
		<% end %>
	<% end %>
<% end %>

store.js.coffe

$(document).on "ready page:change", ->
  $('.store .entry > img').click ->
    $(this).parent().find(':submit').click()
Generic-user-small
10 May 2015, 06:07
Vishal Deepak (3 posts)

Found a solution by looking at errata

https://pragprog.com/titles/rails4/errata

Change to

$(document).on “ready, page:change”, ->

Change from

$(document).on “ready page:change”, ->

I have added only a comma preserving the space

You must be logged in to comment