It works fine in the show method, but fails in add_to_cart.
On Sunday, March 5, 2017 at 1:37:54 PM UTC-5, Hassan Schroeder wrote:
>
> On Sun, Mar 5, 2017 at 10:23 AM, Joe Guerra > wrote:
>
> > def calc_remaining
> > @taken = Cart.where('product_id' => @product).count
> >
> > @remaining =
On Sun, Mar 5, 2017 at 10:23 AM, Joe Guerra wrote:
> def calc_remaining
> @taken = Cart.where('product_id' => @product).count
>
> @remaining = @product.qty - @taken
> end
> but when I call it from my add to cart method, @product.qty is undefined
> method `qty' for nil:NilClass.
And that tel
ok, here's my method...
def calc_remaining
@taken = Cart.where('product_id' => @product).count
@remaining = @product.qty - @taken
end
but when I call it from my add to cart method, @product.qty is undefined method
`qty' for nil:NilClass.
On Thursday, March 2, 2017 at 11:07:06 AM UTC-5,
3 matches
Mail list logo