similar to: Transactions

Displaying 20 results from an estimated 10000 matches similar to: "Transactions"

2010 Dec 08
2
Bug in nested transactions in rails 2.3.x
Hello! According to ActiveRecord transactions documentation, User.transaction do User.create(:username => ''Kotori'') User.transaction(:requires_new => true) do User.create(:username => ''Nemu'') raise ActiveRecord::Rollback end end User.find(:all) # => Returns only Kotori But I get both records in database (tested on
2006 May 31
7
Rails, Transactions, and statements
Hi, I have a problem where I need an auto-incremented id back from the database for a statement that has yet to be committed. The operation that uses the id may fail, and if so, I need to rollback the database. I can''t figure out how to send only the statement to the database without the commit without sending over hard coded SQL. This is what I started out with: 1 def add_album
2006 Oct 03
2
Rails transactions issue with rollback.
Hi, I have a transaction in which a duplicate key exception is being thrown by MySQL. I assume this happens when I try to do a save. The problem is that before the save, I do a destroy on another object as part of the transaction. Catching the exception by doing this, User.transaction do begin objA.destroy objB.save <-- causing exception rescue Exception => exc
2007 Apr 04
1
pontential bug in rspec_on_rails and ActiveRecord transactions
Hello rspec-users, I''ve encountered a strange bug in rspec, but it may be me who is wrong. I''m running latest version from the trunk (r1678) of both rspec and rspec_on_rails. Please consider the following model: class Url < ActiveRecord::Base def after_save Contact.create!(:primary_email => ''user at example.com'') raise
2015 Nov 05
1
synthesizing yum transactions
Ok, I'm trying way too hard to shovel myself out of a hole. We have a bunch of remote CentOS 6 servers, that were configured with kickstart. They've subsequently had additional RPMs installed/updated via the 'rpm' utility. We have reason to occasionally rewind the state of the server back to it's original set of RPMs. Of late, we've found that 'yum' handles this
2005 Mar 31
4
Transactions
I cant seem to find much information apart from the basics on transactions in rails. I have 5 nested transactions, and am performing the following basic operations: @whatever1.transaction do @whatever2.transaction do .... @whatever2.something = "foo" @whatever1.something = "bar" @whatever1.save @whatever2.save ..... end end ((( I had tried using
2011 May 08
1
Transaction - but no rollback?
Hello, I''m having trouble with transactions with rails 3.0.3 and mysql 5. I''d like to import data etl-batch-style: class Job < ActiveRecord::Base # ... def perform_etl connection.transaction do extract # some connection.execute / job.update_attribute stuff transform # some connection.execute / job.update_attribute stuff end end #... end
2009 Nov 10
12
[RFC] big fat transaction ioctl
Hi all, This is an alternative approach to atomic user transactions for btrfs. The old start/end ioctls suffer from some basic limitations, namely - We can''t properly reserve space ahead of time to avoid ENOSPC part way through the transaction, and - The process may die (seg fault, SIGKILL) part way through the transaction. Currently when that happens the partial transaction will
2006 Oct 06
1
transactions not work for array?
Hi, I have a transaction block as follow: begin Hello.transaction(input1,input2) input1.save for i in 0 to count input2[i].input1_id = input1.id input2[i].save end end rescue end I have used validates_uniqueness_of for input2 in the model The problem is, when there is duplicate record in input2, input1 and the first record in input2
2010 Jul 23
7
fail rollback transaction with manual raise exception
With : PostgreSQL 8.4 or postgresql-8.3 rails 2.3.4 pg 9.x or pg 8.x I test this code: ========================= class NkiBatch < ActiveRecord::Base Bank.connection.transaction do bank = Bank.new(:name => "ddsjdsjdsjk") bank.save! raise ActiveRecord::Rollback.new end end and this: ========================= class NkiBatch < ActiveRecord::Base
2008 Jul 28
1
callback executed like after_save but after transaction
I''m trying to add some code for my ActiveRecord class so that it is executed whenever an object is updated, this code is a seperate process that reads from the same table represented by my model class so when it runs it needs the database to be up to date. In the following situation this is fine: # MyModel def after_save `/usr/local/bin/update_models -i #{self.id}` end # controller
2005 Apr 12
2
Transactions, audit trails, and logging (fairly long)
I''m building a system where every change made to the database has to auditable. Every time a change is made I store a timestamp, a user id, and description of the transaction in a db_transactions table. Every other table has a transaction_id field that references what transaction last created or updated it. How I handle updates now is have a DbTransactions model that contains
2006 Sep 11
4
Using rspec and mocha
I prefer to use rspec than test::unit for developing my apps. However I''ve found its mocking library to be pretty inflexible compared to Mocha. This isn''t really a surprise since rspec isn''t intended as a mocking framework, whereas Mocha is. So I''d like to play to both of their strengths and use rspec as my testing/specification framework and Mocha do to
2006 Sep 11
4
Using rspec and mocha
I prefer to use rspec than test::unit for developing my apps. However I''ve found its mocking library to be pretty inflexible compared to Mocha. This isn''t really a surprise since rspec isn''t intended as a mocking framework, whereas Mocha is. So I''d like to play to both of their strengths and use rspec as my testing/specification framework and Mocha do to
2007 Oct 08
3
test not rolling back
For testing, I use: self.use_transactional_fixtures = true This should cause a ROLLBACK for each test case. If I run a single file, foo_controller_test.rb, it works as expected. I see BEGIN and ROLLBACK 8 times in the log files. But if I run: rake test:functionals I get 3 COMMITs, 196 BEGINS and 193 ROLLBACKs. The code in fixtures.rb that deals with this is : def
2007 Apr 08
8
SQLite3 build is broken because calling rollback!() doesn't prevent COMMIT
I know why SQLite3 is broken. This code: Topic.transaction do |transaction| transaction.rollback! end results in the following database commands: BEGIN; ROLLBACK; COMMIT; In other words, there is a COMMIT when no transaction is in flight. MySQL and Postgres are coll with it, but SQLite3 blows up with indignation. Recorded as a ticket: http://dev.rubyonrails.org/ticket/8030
2005 Dec 22
13
in-memory SQLite for testing
I am following the rails book, and arrived to the section about testing. The test database is configured as: test: adapter: sqlite3 database: ":memory:" and I get this error with the simple product test: % ruby test/unit/product_test.rb Loaded suite test/unit/product_test Started E/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/ errors.rb:94:in
2006 Mar 01
5
single transaction migrations
Hi! It seems that migration doesn''t use single transcation to execute the needed migrations for the database upgrade, so if I have database at version 5, and I wrote some migrations 6..10, and error occurs while executing migration 7, the database stays in state 6? I also think that migration taks could use some more verbosity, for example if migration fails, there''s no
2006 Aug 16
14
Migrations: only one table per migration file?
Hi all I have a new migration file created that adds some tables and fills one with some data: create_table :sound_styles do |t| t.column :name, :string, :null => false end create_table :show_types do |t| t.column :name, :string, :null => false end create_table :countries do |t| t.column :name, :string, :null => false end ActionView::Helpers::FormOptionsHelper::COUNTRIES.each
2008 Apr 30
6
best practice for object transaction?
I have a new @offer that needs to generate a document if saved. But that''s all or nothing: transaction do @offer.save! generate_document end # handle exceptions if needed If save! fails everything is fine, but if generate_document raises an exception @offer is left as a model with timestamps, id, which is not a new_record? anymore (though the database was