lib/rack_datamapper/restful_transactions.rb in rack-datamapper-0.2.4 vs lib/rack_datamapper/restful_transactions.rb in rack-datamapper-0.2.5
- old
+ new
@@ -15,10 +15,10 @@
status, headers, response = nil, nil, nil
begin
transaction = DataMapper::Transaction.new(DataMapper.repository(@name))
transaction.commit do
status, headers, response = @app.call(env)
- raise Rollback unless [301, 302, 303, 307].include?(status)
+ raise Rollback unless (200 <= status && status < 400)
end
rescue Rollback
# ignore,
# this is just needed to trigger the rollback on the transaction
end