Решил проблему следующим образом :
Show_product_to_customer view:
=form_for @line_item, url: create_line_item_path, html: {method: 'post'} do |f|
=f.hidden_field :product_id, value: @product.id
=@product.title
br
=f.collection_select(:size_id, @product.sizes.all, :id, :name)
=f.submit 'В корзину'
routes.rb
get 'line_items', to: 'line_items#create', via: 'post' , as: 'create_line_item'
show_product_to_customer controller:
def show_product_to_customer #товар, показываемый пользователю
@product = Product.find(params[:id])
@line_item =LineItem.new
end
Line_items controller:
def create
@cart = current_cart
size = Size.find(params[:line_item][:size_id])
product = Product.find(params[:line_item][:product_id])
@line_item = @cart.add_product(product.id, size.id)