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:
Skud
2013-05-18 11:32:14 +10:00
parent 7c2fc52009
commit c644753a9b
2 changed files with 3 additions and 1 deletions

View File

@@ -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

View File

@@ -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