similar to: save''s implicit transactions when updating?

Displaying 20 results from an estimated 50000 matches similar to: "save''s implicit transactions when updating?"

2006 Apr 26
10
save new model with child model
Hi, I am having a problem saving a new model that has an associated child model. If a new ticket is being created and will have one comment to go with it then I tried this in my action @ticket = Ticket.new(params[:ticket]) @comment = Comment.new(params[:comment]) @ticket.comments << @comment if @ticket.save @notice = "Ticket added. Thanks for
2007 Jan 19
0
Do transactions fail with polymorphic has_one relationships?
I have an AR::Base descendant with a complex object graph beneath it, like so: ArtisanQuoteInput has_one QuoteInput and then QuoteInput has several objects attached to it. Note that the relationship between ArtisanQuoteInput and QuoteInput is polymorphic, so the relationship in A is written has_one :quote_input, :as => :program_quote_input If @artisan_quote_input is an instance of
2006 Jan 09
0
Saving or updating multiple models
Hello all, I was wondering how one would create multiple models in one controller action. Consider the following models: class Worker < ActiveRecord::Base belongs_to :person belongs_to :user validates_presence_of :person_id end class Person < ActiveRecord::Base has_many :workers end class Client < ActiveRecord::Base has_many :workers end class User <
2006 Jun 13
4
When saving parent fails, children will still be updated
Hi all, When submitting a master/detail form I first want to handle the children before saving the parent. There are has_many and belongs_to relations between the parent and the children, so I can edit the children using (psuedo-)code like: child.destroy for deleting, child.update_attributes for updating and @parent.children.push(child) for adding child-records. I update the parent by using:
2007 Jun 30
3
transactions with two models
Hi, In Agile Web Development with Rails section on Transactions (p 381) there are two main examples. 1) making changes in two records in the same database table 2) making changes in two records each in a different *database* I want to do what is in between: changes in two records each in a different table of the same database. Suppose they are apples and oranges tables. How do I write this?
2006 May 31
1
Help enhancing acts_as_nested_set
I''m trying to enhance acts_as_nested_set. Well actually I already have, but I''ve done a hack up job of it. I would like to contribute these enhancements back, but I need a little help. I''m a complete newbie to this stuff. The only thing I new before coming into this project was vanilla HTML. So over the course of two weeks I''ve picked up Ruby, Rails, MySQL,
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
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
2006 Jan 15
2
removing old rails docs after updating rails
Hi, When I start gem_server and look at localhost:8808 I can see multiple version of actionpack, activerecord etc. Is there a command to delete the old documentation after I update rails? Thanks, Peter
2007 Jun 01
0
Turning off activerecord transactions
I have an import script that uses ActiveRecord, but it is generating a single transaction per SQL query. My import script is also threaded, so I don''t want to use ActiveRecord::Base.transaction {} blocks in my threads. Is there a config option that will just let me turn off transactions altogether? Thanks, David Balatero --~--~---------~--~----~------------~-------~--~----~ You received
2006 Mar 24
6
Should counter_cache fields be saved in the database?
As far as I can tell, the counter_cache option on a belongs_to model doesn''t actually save anything in the database. For example, I have the following models: class Parent < ActiveRecord::Base has_many :children, :conditions => "deleted_at IS NULL" end class Child < ActiveRecord::Base belongs_to :parent, :counter_cache => true end With the following
2006 Jan 19
7
validates_numericality_of positive integer
Hi, What is the simplest way to validate a positive integer? validates_numericality_of :foo, :integer_only => true how do I add the positive part? Do I need another validation statement for pattern matching or do I have to write a validate() funciton for my model? Thanks, Peter
2006 Jul 06
0
ActiveRecord''s bundled Transaction::Simple namespace issues?
Hello all. I''m working on a program that uses both ActiveRecord and PDF::Writer. The latter requires the Transaction::Simple module, and ActiveRecord contains a "built-in" copy of Transaction::Simple - but the namespaces appear to clash, if I''m understanding things correctly. (I''m a bit of a ruby nuby, so please excuse me if I''m misunderstanding this
2012 Jun 09
0
Re: ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'Transactions::DummyDdnlTransaction'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. P
FIXED: Transaction is a reserved word, and it cannot be used even though I put it into its own module. So my guess is Transactions::Transaction still somehow got resolved to the Rails internal Transaction class. Renamed the Transaction (and its subclasses) to Transact and it works fine now. Thanks! -- cmdjohnson On Sat, Jun 9, 2012 at 3:08 AM, Commander Johnson
2005 Jun 13
3
assignment of inidividual variables from spss save files
New to R, can't afford SPSS! Why can't I assign spss variables? Here are the details. > ### I've read in my collaborator's sav file using read.spss, eg > children = read.spss(filename) > ### It has many variables > length(children) [1] 347 > ### and I would like to assign individual variables. > ### I can of course type out all the ones I want, eg >
2006 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
Hi, I have a real simple association setup here that''s just trying to: - Create a new PayjunctionOrder - Create some LineItem objects and assign them to the PayjunctionOrder - Save everything I''m using Rails Edge. ---- class PayjunctionOrder < ActiveRecord::Base has_many :line_items end ------------------ ---- class LineItem < ActiveRecord::Base belongs_to :order,
2006 Feb 01
0
Please explain transactions within sqlserveradapter.rb ?
Hello everyone, I am needing to resolve an error on sqlserveradapter revolving around a trigger on a table. When the AR object is saved, AR throws Cannot create new connection because in manual or distributed transaction mode. at from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' In order to resolve this, I
2006 Mar 22
14
currency conversion webservice in a rails app?
Hi, I''m interested in using a currency conversion web service in my rails app. Does anyone have a free service that they use and like? I found this one http://www.webservicex.net/WS/WSDetails.aspx?CATID=2&WSID=10 I''ve tried to make a simple, plain Ruby script to connect to this and get a conversion rate without success. How do I integrate a webservice into my rails app? I
2006 Jul 07
5
Can a route require POST or GET? / REST problem with routing
Hi, A store front a customer wants to GET /product/5/show. But for the application this is really GET /cart_item/new/5 or even better /cart_item/new?cart_item[product_id]=5 When the customer clicks add_to_cart they POST /product/5/show so that the url doesn''t confuse the user when any validation errors occur. But for the applicaiton this should be POST
2006 Apr 01
4
problems getting ActionMailer working (on server)
Hi, I''ve read the Agile Rails book''s chapter on ActionMailer a few times. Seems pretty straight forward. Unfortunately I can''t get my application to actually send mail. I uploaded my application to the web server and tried to get a mail message sent. Nothing happened. I looked in the log file and it says Sent mail: From: service@freedomkilts.com To: