I copied and pasted and ran this code and it worked fine for me. Any
stray "," characters?
On May 16, 6:50 pm, Orient Fang wrote:
> HI,
> I have almost the same issue when I follow the 3rd Edtion.
> but I verified the every type characters, there should be no mistakes.
> Any one could help?
> ---
On 17 May 2010 02:50, Orient Fang wrote:
>
> HI,
> I have almost the same issue when I follow the 3rd Edtion.
> but I verified the every type characters, there should be no mistakes.
> Any one could help?
> -
> SyntaxError in StoreController#add_to_cart
> D:/InstantRails/rails_apps/lzpback
HI,
I have almost the same issue when I follow the 3rd Edtion.
but I verified the every type characters, there should be no mistakes.
Any one could help?
-
SyntaxError in StoreController#add_to_cart
D:/InstantRails/rails_apps/lzpback/app/models/cart.rb:14: syntax error,
unexpected kEND, e
> class Cart
> attr_reader :items
>
> def initialize
> @items = []
> end
>
> def add_product(product)
> current_item = @items.find {|item| item.product == product}
> if current_item
> current_item.increment_quantity
> else
> @items << CartItem.new(product)
>
I had this same problem and I find this really weird because I was using
the actual code supplied by the book and was getting the error. When I
added an extra "end" to the bottom of the file it worked. Can someone
tell me why this code works:
class Cart
attr_reader :items
def initialize
5 matches
Mail list logo