mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-16 20:49:26 -04:00
Call update_account when you complete an order.
Also had to tweak product.update_account to actually save the account!
This commit is contained in:
@@ -32,9 +32,10 @@ class OrdersController < ApplicationController
|
||||
@order = Order.find(params[:id])
|
||||
|
||||
@order.completed_at = Time.zone.now
|
||||
# current_member.paid = true # or whatever
|
||||
@order.save
|
||||
|
||||
@order.update_account # apply paid account benefits, etc.
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
end
|
||||
|
||||
@@ -23,6 +23,7 @@ class Product < ActiveRecord::Base
|
||||
start_date = member.account.paid_until || Time.zone.now
|
||||
member.account.paid_until = start_date + paid_months.months
|
||||
end
|
||||
member.account.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user