similar to: Multiple Inserts

Displaying 20 results from an estimated 50000 matches similar to: "Multiple Inserts"

2007 Sep 26
0
activerecord multiple databases
So, I was looking for a setup that would allow me to easily query multiple databases and not have to re-write my customer finder type queries. Here is what I came up with and it seems to be working for me in my very basic tests so I thought I''d share. Just posting it in case this helps anyone else trying to do the same thing. I''m using this with activerecord, but not rails, so
2006 Mar 13
1
adding custom cache field
Hello, I needed to add custom cache field for one of my application. I thought I will share the code showing how to do this. This code below creates and maintain a custom cache field, for keeping track of totals. Say, you have accounts, and for each account there are transactions (either deposit/withdrawal), and one will like to keep track of the total balance for an account. So, let there be a
2012 Oct 24
1
Uniqueness and sql serialize
Hi fellow programmers, I was looking for how to keep integrity in some financial transactions and I saw this "This could even happen if you use transactions with the ‘serializable’ isolation level." in the uniqueness page http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of. How this is possible with the serializablo
2008 Apr 04
2
TransactionError
Hi Today I got an alert mail from my watcher script, telling me that there was no Mongrel running, and that it started one (so the site was down for a few seconds.) This is the first time I got this error (AFAICS), but I''d like to resolve and prevent it for the future. From mongrel.log: ** Starting Mongrel listening at 0.0.0.0:foo ** Starting Rails with production environment... **
2006 Mar 29
1
htdig with omega for multiple URLs (websites)
Olly, many thanks for suggesting htdig, you saved me a lot of time. Htdig looks better than my original idea - wget, you were right. Using htdig, I can crawl and search single website - but I need to integrate search of pages spread over 100+ sites. Learning, learning.... Htdig uses separate document database for every website (one database per URL to initiate crawling). Htdig also can merge
2006 Mar 29
2
inserts now set unset columns to null
Hi, I upgraded to Ruby 1.8.4 and whatever the latest Rails is as of March 29 2006. I am using PostgreSQL 7.4. With the earlier version of rails, I had insert queries that looked like this: Topic Create (0.001189) INSERT INTO topics ("inlibrary", "irx_display_title", "irx_title", "title", "creation_stamp", "last_update_stamp",
2007 Jan 17
1
include ClassMethods in plugins
Why is that in so many plugins I see people using (including acts_as_taggable by DHH): # init.rb ActiveRecord::Base.send(:include, ActiveRecord::Acts::SomeModule) # lib/some_module.rb module ActiveRecord module Acts module SomeModule def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_something # code
2007 Jul 17
0
Multiple inserts on a through association.
class Trunk < ActiveRecord::Base has_many :call_type_trunks has_many :call_types, :through => :call_type_trunks end class CallType < ActiveRecord::Base has_many :call_type_trunks has_many :trunks, :through => :call_type_trunks end class CallTypeTrunk < ActiveRecord::Base belongs_to :call_type belongs_to :trunk end The associaton class has a column named price.
2005 Dec 15
13
Fast Bulk Inserts?
I need to insert ~100k rows into the database, but using "Table.new(...).save" is painfully slow (I notice in the logs that it''s wrapping each insert in a transaction -- that can''t be fast). Any suggestions on how I can improve the speed of bulk inserts like this? Thanks ... -- Steve
2006 Jul 10
1
ActiveRecord batch insert for MySQL
Hi guys, I am a pretty new developer for RoR, and I am wondering whether batch inserts for ActiveRecord are available. I know that ActiveRecord::Base::create accepts an array of hashes, but from the MySQL logs, I can see that the inserts are not batched. Would like to stay within the ActiveRecord framework, if possible. Thanks in advance for comments and suggestions. v -- Posted via
2005 May 14
2
ActiveRecord::Associations::ClassMethods Documentation Issue
I''m curious, but isn''t this example in the documentation for ActiveRecord::Associations::ClassMethods somewhat counter-intuitive? The SQL DDL is correct for the way it''s used in the models. But isn''t it more logical that an author would have many posts, rather than many authors having one post? From
2006 May 17
2
ActiveRecord::Associations ER diagram/macros
Hello, I found an interesting ER diagram on the "Module: ActiveRecord::Associations::ClassMethods" page of the Rails Framework Documentation : http://ar.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html At the beginning we can read ? Associations are a set of macro-like class methods for tying objects together through foreign keys. They express relationships like
2006 Jul 02
1
prevent duplicate inserts with has_many :through ??
Does anyone have an efficient/elegant way to prevent duplicate inserts when using a has_many :through relationship. So I have something like this: class User < ActiveRecord::Base has_many :favorite_teams has_many :teams, :through => :favorite_teams end class FavoriteTeams < ActiveRecord::Base belongs_to :user belongs_to :team end class Teams < ActiveRecord::Base has_many
2005 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
I''ve got a really strange problem using belongs_to. I apologize in advance for the length... this is going to take a while to explain. Basic idea: Creating a User requires that the user enter an email address and activation key that matches an existing PendingUser. After creating the user successfully, that pending user should be marked as "used". The problem: When I
2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object was newly created? Hopefully this will explain my question: A Firm class declares has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients and a client class declares
2006 Nov 04
0
ActiveRecord, insert and not auto-incremented primary keys...
Hi, After playing while with ActiveRecord, I''m surprised it isn''t easier to insert data into a table whose primary key is not auto-incremented by the database server. The following code... --------------------------------------- -- MySQL database "test" --------------------------------------- CREATE TABLE gardens ( code integer NOT NULL, name
2007 Jun 16
1
extending activerecord base with after_initialize
hi, i am having problems getting after_initialize for activerecord subclasses. basically, i am trying to use the guid plugin by andy singleton. i am having problems extending the class to the plugins i installed, so i figured i will just apply this to all the models in my project. i trled to add the following to my lib/ folder. my goal is to extended the activerecord class so that it uses
2009 Jan 03
0
understanding rails internal architecture
i am currently digging into the rails 2.2.2 source to get a deeper understanding of some features (in particular model-validation) and a better overall insight. most of rails features are encapsulated in a separate module - as far as can see - and wired together through mixins. this makes sense and following the logic in the single modules is easy. but i am getting stuck while puzzling to see it
2006 Mar 13
2
relationship woes
I have two tables: class PgmUpdate < ActiveRecord::Base has_many :pgm_visits, :foreign_key => ''pgm_update_fk'' ... and class PgmVisit < ActiveRecord::Base belongs_to :pgm_update, :foreign_key => ''pgm_update_fk'', :dependent => true ... According to the has_many docs (http://api.rubyonrails.org/classes/
2009 Sep 11
0
Need help with extending a plugin
hey folks I''ve installed the plugin acts_as_taggable_on_steroids (henceforth aatos), and i already have some tagging functionality set up, using the same approach (ie a Tag and a Tagging class with associated tables) as aatos. So, i want my existing Tag and Taggings methods, plus some other methods i have in a module which i include with the taggable classes (ie the ones that would call