Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

/variants/:id/reset.json

  • Loading branch information...
commit b2f5ca6623da1a120d884914ad5c57f9eaad5460 1 parent 14c3d3c
@winton authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.