ok, still confused
I've defined my parms like this...
def cart_params
# params.fetch(:cart, {})
params.require(:cart).permit(:user_id, :product_id )
end
Have this in my controller.
def add_to_cart
product_id = params['id']
user_id = session['user_id']
@cart = Cart.new(us
Controller action methods do not take parameters. You get the parameters
from the `params` hash. Also, as was mentioned, do not send user_id as a
param. It is a security error, and you don't need to because you can access
the session in the controller:
def add_to_cart
product_id = params["pro
2 matches
Mail list logo