Permalink
Browse files

Update the previous record when tracking from a record category

  • Loading branch information...
1 parent e1129fc commit 0026e57dc8fa956fa5bb56fbee67fc00dd3bc9bf @sachac committed Dec 17, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 app/controllers/record_categories_controller.rb
@@ -172,9 +172,12 @@ def destroy
def track
authorize! :manage_account, current_account
@record_category = current_account.record_categories.find(params[:id])
- # Update the latest activity now that we know the ending timestamp
now = Time.zone.now
rec = current_account.records.create(:timestamp => now, :source => 'quantified awesome record categories', :source_id => @record_category.id, :record_category_id => @record_category.id)
+ if rec
+ rec.update_previous
+ rec.update_next
+ end
respond_with rec do |format|
format.html { redirect_to(edit_record_path(rec)) }
end

0 comments on commit 0026e57

Please sign in to comment.