last day (22 days later) » 

10:00 PM
0
A: Rails: Updating quantities in shopping cart

Rich PeckWith this type of pattern, you're best DRYing up your logic into a single action: #config/routes.rb resources :line_items do match :qty, action: :qty, via: [:post, :delete], on: :member #-> url.com/line_items/qty end #app/models/line_item.rb class LineItem < ActiveRecord::Base after_updat...

 
Thanks Rich. I edited my post, it's a routing error.
Thanks again, I've edited my post again. We're on the right track!
Also line_items_qty_path(line_item) threw an error, checked the routes and changed it to qty_line_item_path(line_item). The first problem was because I only changed that part of the link instead of adding the POST method.
 
Yes, you will need to make sure the routes are okay. I should have stipulated that the routing helpers I posted were only meant as placeholders
 
So how do I get that current_cart variable working?
 
Don't you have the code to support it? Last time I checked, it should be supported with some sort of session array, but I don't know because I don't know which tutorial you're using
 
I suppose I don't
 
10:00 PM
Do you have a github repo I could look at?
 
Somehow my github configuration got all screwed up so I had to get that sorted out. github.com/TylerTaylor/depot
 
Okay as I thought, you don't have any code to define current_cart - I'll write an update
 
Okay now I'm getting the same error but for line_item. Session stuff is definitely new to me, so I'll have to check out that link.
 

  last day (22 days later) »