Pas de méthode

Bonjour,

J’ai un étrange message quand j’essaye de visualiser ma vu contenant ce
code

contenu de votre panier

<% for item in @items product = item.product %> <% end %>
<%= item.quantity %> <%= h(product.title)%> <%=item.unit_price %> <%=item.unit_price * item.quantity %>

voila le message

NoMethodError in Store#display_cart

Showing app/views/store/display_cart.rhtml where line #5 raised:

undefined method `product’ for 5.0:Float

Extracted source (around line #5):

2:


3: <%
4: for item in @items
5: product = item.product
6: %>
7:
8:

RAILS_ROOT:
/Users/bolomichelin/Documents/Creation_Perso/Developement/depot/public/…/config/…

et pourtant quand j’essaye ca
<%= @items.size %>

ca marche

merci

<%= item.quantity %>

alors je fais quelque test
quand j’essaye ca

<%
for item in @items
end
%>
la boulce fonctionne bien. Donc quand j’essaye d’acceder un element de
items
ca passe
voila le code de class lineitem

class LineItem < ActiveRecord::Base
belongs_to :product
def self.for_product(product)
item =self.new
item.quantity =1
item.product = product
item.unit_price = product.price
item
end
end

Merci pr le coup de main d’avance
2006/8/14, Bolo [email protected]: