Oh, I didn't notice that.. thanks a lot .. I appreciate it. 2009/6/18 Frederick Cheung <[email protected]>
> > On Jun 17, 10:51 pm, Xiahong Gao <[email protected]> wrote: > > > --------------------------------------------------------------------------- > ------------------------------------- > > class StoreController < ApplicationController > > > > def index > > @products = Product.find_products_for_sale > > end > > > > private > > def find_cart > > session[:cart] ||= Cart.new > > end > > > > def add_to_cart > > @cart = Cart.new > > product = Product.find(params[:id]) > > @cart.add_product(product) > > end > > You've made your add_to_cart action private which it shouldn't be > ( rails ignores private methods when looking for actions, so it has > just rendered the template without running your add_to_cart method at > all. > > Fred > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

