Displaying 20 results from an estimated 30000 matches similar to: "ActiveRecord: ar-each_model"
2011 Aug 25
3
ActiveRecord searching in batch (with find_by_sql)
I have an issue where I am getting a large number of records from the
database and I cant afford to keep it in the memory due to performance
issues.
Therefore using the following would be ideal,
User.find_each(:batch_size => 5000, :start => 2000) do |user|
NewsLetter.weekly_deliver(user)
end
however,
I would like to use find_by_sql since my query is user defined. Question
is, is it
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all,
In my controller I am doing the following to populate a nested form for a
has_many through association:
def new
@specification = Specification.new
Component.find_each.each do |component|
@specification.component_specifications.build(:component_id =>
component.id)
end
The idea being whenever someone creates or edits a form, it will be
populated with all
2008 Jan 17
6
Problems with sqlserver 2000 and ActiveRecord
Hi,
I''m getting some trouble in connecting to a sql server 2000
database with ActiveRecord-2.0.1 and ruby 186-26, from
win XP.
Using the next conenction config:
ActiveRecord::Base.establish_connection(
:adapter => "sqlserver",
:database => "nombre_bd",
:username => "usu",
:password => "contra"
)
I have the next error:
2006 Mar 14
3
ActiveRecord row-by-row processing
I want to use ActiveRecord outside of Rails to do processing on large
tables. I want to be able to process the rows as they are retrieved
rather than having to store the results in an intermediate array.
Any suggestions?
Looks like I could hack the adapter to provide an accessor to the
underlying DBI handle. Anything cleaner than that?
2013 Oct 25
6
Migrate postgresql database to uuid
Hi all,
I am using rails 3.1 and ruby 1.9.3,Now i want to use uuid concept in
rails 3 for existing data
so i did like :-
create_table :posts, :id => false do |t|
t.string :uuid, :limit => 36, :primary => true
end
ActiveRecord::Base.class_eval do
# old rails versions
set_primary_key ''uuid''
before_create :generate_uuid
def generate_uuid
self.id =
2011 Apr 09
4
API documentation for find_in_batches
Hello,
At guides.rubyonrails.org I read about the possibilities of
find_in_batches. However I cannot find this option anywhere in the API
documentation (api.rubyonrails.org).
My question: where should I look for the documentation of this
command?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
2007 Dec 10
8
could not find activerecord-sqlserver-adapter locally or in a repository
I''m trying to connect to a SQL Server db. I thought I installed the
DBI component per the instructions, but its not working.
When trying to start the ruby server, I get the message:
Please install the sqlserver adapter: `gem install activerecord-
sqlserver-adapter`
But when I try to install the repository, I get this error message:
could not find activerecord-sqlserver-adapter
2009 Sep 14
9
ActiveRecord::StatementInvalid (invalid date) with Oracle
Hello all. I am a novice Ruby on Rails programmer, starting my first
project using a legacy Oracle 10 database. Using ''reverse_scaffold'' I
have created the models/controllers/views for my existing Oracle
tables.
All seems to work well, using /model/index, /model/show for most of my
tables, *except* when one of the tables contains a Oracle ''date''
column, for
2006 Jun 02
5
ActiveRecord: Getting table names
How do i get (discover) all the table names within a database using
ROR/ActiveRecord ?
I wish to build a webapp that connects to a database on the fly,
discovers tables and column names etc and then can show data or build a
report based on user selection. The ActiveRecord API doesnt seem to give
any method for getting table names.
--
Posted via http://www.ruby-forum.com/.
2005 Mar 06
9
How to do SQL queries outside of AR
Hi Everyone,
I''m trying to figure out how to do SQL queries in the Controller. I know
this is not recommended, but I can''t use ActiveRecord because I am
dealing with thousands of a different tables, one for each user, and
I don''t think AR can be made to handle that situation.
You can assign the table name; but that''s a class variable so any particular
2009 Apr 14
6
SQL Server via DBI/ODBC configuration
I have followed the cookbook on http://wiki.rubyonrails.org/database-support/ms-sql
but am having problems with the rails part. I can connect to the
database using sqsh so I think all the freetds plumbing is good. When
I try to connect to the db with a rake db:migrate or just using script/
console I get this error:
>> Client.find(:first)
DBI::InterfaceError: Unable to load driver
2007 Jan 26
10
Camping and DBI
Hi,
I''ve been playing around with using DBI instead of ActiveRecord ''cause
I just love to beat myself up! ;) Is this an okay way to do this, or
is there any other more creative ways?
require ''dbi''
module MyApp:Models
class DB
def self.dbh
DBI.connect(''DBI:Mysql:dbname'', ''username'',
2008 Feb 29
17
Is SQL Server not supported in RoR on the Mac?
Hi -- I''ve been having problems connecting to a SQL Server database that
I thought might be related to the fact I was upgrading Rails to 2.0.
However, I also was moving the project to my shiny new macbook.
Anyway, after jumping through a few hoops (instaling DBI, etc.), I
finally get to my latest error message:
<error>
DBI::InterfaceError: Could not load driver (no such file to
2009 Feb 05
1
Need the activerecord-sqlserver-adapter but...
Hi... I am new to RoR development, and Web development in general (but
have about 25 years of IT/software experience - just not in the Web
area)... I have a really good RoR 2.X book that I have read and reread a
few times and starting to try to apply what I read... Have a Web app
that I need to write at work, and prove to folks that RoR is THE_WAY,
despite their ASP .NET protests otherwise...
So,
2005 Mar 10
1
Running unit tests on SQL Server
Hi everyone,
It''s been more than a month since I last fired up Ruby or ActiveRecord, so
imagine my surprise when, after getting the latest source and running the
unit tests for MySql, I was greeted with a screen full of errors.
I''ll come back to the MySql errors later. What follows is the output I get
when I run the tests for SQL server.
I installed ruby with the one-click
2006 Apr 07
2
MSSQL activerecord uses bad syntax
Hi all,
I''m trying to get rails up on mssql for a friend, does anyone have
experience? We''re working on a Windows XP box with MSSQL 2000 (no
service pak), and both rails (1.1) and MSSQL are on the same box. I''m
running into a bug (I think) where activerecord is using this syntax:
SELECT TOP 1 * FROM users WHERE (users.user = ''jbgnuumnbu'')
2006 Jan 05
3
MS SQL server connection problems
I am trying to connect to a remote sql server and I am getting the
following error:
c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb:57:in `connect'': Open
(DBI::Databa
seError)
OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist
or access
denied.
HRESULT error code:0x80020009
Exception
2006 Jul 24
7
[PATCH] Support for DB Clusters/Replication in ActiveRecord (RFC)
Skipped content of type multipart/alternative-------------- next part --------------
Index: connection_adapters/abstract/connection_specification.rb
===================================================================
--- connection_adapters/abstract/connection_specification.rb (revision 4617)
+++ connection_adapters/abstract/connection_specification.rb (working copy)
@@ -1,10 +1,21 @@
require
2006 Jan 10
1
sql server & linux: left join problem
I''ve got a left join problem of some sort connecting from linux
FreeTDS/ODBC to SQL Server. It''s similar to the false post I had
earlier, but this is a real problem. Here''s my code:
def find_recipes_for_workorder
@recipe_pages, @recipes = paginate_with_sort :recipes, :per_page
=> 10, \
:joins => ''left join workorder on
2006 Jan 10
1
sql server freetds/odbc question
I''m having an error from Linux via freeTDS/ODBC to SQL Server with
cod that runs fine against SQLite and MySQL. Here''s the code:
def find_recipes_for_workorder_by_id
@recipe_pages, @recipes = paginate_with_sort :recipes, :per_page
=> 10, \
:conditions => ["recipe.workorder_id = ?", params
[:workorder]]
render :template =>