small medium large xlarge

26 Jan 2012, 00:21
Kranthi.akula (1 post)

Iam working on ruby 1.8.7 and rails 3.0.5. After creating products table and changing the default scaffold code in index.html.erb, the following is the code.

Listing products

<% @products.each do |product| %> <%= image_tag(product.image_url, :class => 'list_image') %>
<%= product.title %>
<%= truncate(strip_tags(product.description), :length => 80) %>
<%= link_to 'Show', product %>
<%= link_to 'Edit', edit_product_path(product) %>
<%= link_to 'Destroy', product, :confirm => 'Are you sure pakka?', :method => :delete %> <% end %>

<%= link_to ‘New Product’, new_product_path %>

The file executed over the browser very well but the problem is when i click the link Destroy it is navigating to the page similar to Show link rather than displaying the page with “Are you sure you want to delete” where we can delete the product from the list of products. can any one solve this issue from me please.

26 Jan 2012, 03:17
Sam Ruby (633 posts)

Do you have JavaScript enabled?

Just a guess, but can you verify that your app/views/layouts/application.html.erb includes the default javascript libraries? The file should look like this:

(depending on your browser, you might need to view-source to see the underlying html)

You must be logged in to comment