line_items_controller.rb
def create
product = Product.find(params[:product_id])
@line_item = @cart.line_items.build(product: product)
respond_to do |format| if @line_item.save
format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }
format.json { render action: 'show', status: :created, location: @line_item }
--
You received this message because you are subscribed to the Google Groups "Hong Kong Ruby on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hkror+un...@googlegroups.com.
To post to this group, send email to hk...@googlegroups.com.
Visit this group at http://groups.google.com/group/hkror.
For more options, visit https://groups.google.com/groups/opt_out.
--