Allow trace descriptions and tags to be edited.
[rails.git] / app / controllers / trace_controller.rb
index 3b30977552feaf41a81990975558d75bfbc2f0be..3eb7f5c7ece1eb0a247e2748c07117f06d79e409 100644 (file)
@@ -120,6 +120,24 @@ class TraceController < ApplicationController
     render :nothing => true, :status => :not_found
   end
 
+  def edit
+    @trace = Trace.find(params[:id])
+
+    if @user and @trace.user == @user
+      if params[:trace]
+        @trace.description = params[:trace][:description]
+        @trace.tagstring = params[:trace][:tagstring]
+        if @trace.save
+          redirect_to :action => 'view'
+        end        
+      end
+    else
+      render :nothing, :status => :forbidden
+    end
+  rescue ActiveRecord::RecordNotFound
+    render :nothing => true, :status => :not_found
+  end
+
   def delete
     trace = Trace.find(params[:id])