Permalink
Browse files

/variants/:id/reset.json

  • Loading branch information...
1 parent 14c3d3c commit b2f5ca6623da1a120d884914ad5c57f9eaad5460 @winton committed Nov 7, 2010
Showing with 15 additions and 1 deletion.
  1. +15 −1 lib/a_b/controller/api.rb
View
16 lib/a_b/controller/api.rb
@@ -193,7 +193,7 @@
:control => i == 0
}.merge(ids))
end
- @test.to_json(
+ @test.reload.to_json(
:include => symbolize(params[:include]),
:only => symbolize(params[:only])
)
@@ -277,4 +277,18 @@
false.to_json
end
end
+
+ post '/variants/:id/reset.json' do
+ content_type :json
+ @variant = Variant.find params[:id]
+ if @variant && allow?(@variant.test)
+ @variant.update_attribute(:data, nil)
+ @variant.to_json(
+ :include => symbolize(params[:include]),
+ :only => symbolize(params[:only])
+ )
+ else
+ false.to_json
+ end
+ end
end

0 comments on commit b2f5ca6

Please sign in to comment.