From c644753a9bfbc9a246ea74c610831e3f416e507a Mon Sep 17 00:00:00 2001 From: Skud Date: Sat, 18 May 2013 11:32:14 +1000 Subject: [PATCH] Call update_account when you complete an order. Also had to tweak product.update_account to actually save the account! --- app/controllers/orders_controller.rb | 3 ++- app/models/product.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 428c1ef37..0da87512e 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -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 diff --git a/app/models/product.rb b/app/models/product.rb index 830880478..dad488d59 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -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