sir,
I am working on rubyonrails,I am getting some errors in that:
add_ to_cart method:
I have created files such as store.controller, in which I defined 3 methods
add_to_cart,display_cart,find_cart
mddels:product.rb,line_Items
In line _items I have created methd self.for_product(product),
in cart.rb file I have initialize the product.
databases:
1.products(holding product info)
2.Line_items(holding cart info)
In application cart I have created 2 models:
1.cart
2.line_item
class StoreController < ApplicationController
def index
@products = Product.salable_items
end
def add_to_cart
product = Product.find(params[:id])
@cart = find_cart
@cart.add_product(product)
redirect_to( :action => ''display_cart'')
end
private
def find_cart
session[ :cart] ||= Cart.new
end
def display_cart
@cart =find_cart
@items =-ruxhHikAxTgpAR6TowUfPQ@public.gmane.org
end
end
In above code when I browse http://localhost:3000/store/display_cart
getting the action link to display_cart but it is not showing any info of
products
Plz help me out in solving this problem
thanks,.
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 267.11.4 - Release Date: 9/21/2005
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails