Displaying 20 results from an estimated 3000 matches similar to: "comparing two databases with Active Record."
2007 Feb 26
24
Ruby/rails port of Cocoon/hibernate
Hi,
I''m currently running an apache/jboss cocoon/flow/hibernate/ajax
paypal (directpayment) project and am looking into the possibility of
porting it across to ruby/rails. For that reason I would like to know
the following:
1. Can I call my java classes or would I be looking at a complete
rewrite in ruby?
2. How effective is ruby in terms of seperation of concerns regarding
design from
2007 Apr 06
3
How to find rows where no row in associated table exists?
Basically, how do I do this "The Rails Way(tm)"
SELECT * FROM beta_users u LEFT JOIN beta_codes c ON u.id =
c.beta_user_id AND c.code IS NULL
At the moment I''m using find_by_sql, and that works Ok, but what would
be the Rails way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2006 Apr 19
1
Separate databases for reads and writes?
Hi all -
New to rails... been reading as much as I can though and have yet to find
a solid answer (although I think I found an unsolid negative).
I''m wondering if there''s a way to split up the reads and writes in Rails
so that pages/actions that don''t need to write can query from a group of
mirrored databases. And my content managers can update a single master.
I
2006 Apr 18
7
Connecting to multiple databases
Hi Everyone,
I am trying to connect to multiple databases and followed along the
Recipe in Chad Fowlers ''Rails Recipes'' book (which basically is about
establishing the connection in a subclass of ActiveRecord::Base, and
inheriting all classes in need of this connection from this class)
Chad Fowler says:
"You won''t be able to instantiate an External, of course,
2006 Jan 19
4
multiple database in the same actions?
Hi,
I read the example in
http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases,
it show us how to connect to other database, each time
we start a new action, however, this doesn''t work
while you try to connect to two different database
within the same action.
SO I wonder is it possible to bind to two or more
database within the same action????
Thanks you very much
Saiho
2006 Mar 27
5
Fake ActiveRecord model?
Hi all,
I have a legacy table which I cannot get to work with ActiveRecord (no
ids etc). All I want is to create a class which opens a connection
manually and allows me to execute some plain SQL statements.
What I can''t figure out is how to either build up a connection and
execute queries from a non-AR inherited class, or how to create a
AR-inherited class minus all the AR magic and
2006 Aug 15
6
try creating a table for your model
Railers:
Greetings from the low end of the learning curve. I have installed all
the prerequisites on Win32, including a lite MySQL database with a
table in it called Inventory.
Then I run this command line...
ruby script/generate ajax_scaffold Inventory
...and I get this error message:
error Before updating scaffolding from new DB schema, try creating
a table for your model
2009 Mar 17
11
Refactoring module
Dear all
Please see the following module, In module SX3 SX4 and SX5 have similar
class Tasklist, but inherit from different class.
I will use the following code to connect to different data sources
RemoteSX3Model.establish_connection sx3_hash
RemoteSX4Model.establish_connection sx4_hash
RemoteSX5Model.establish_connection sx5_hash
How can I refactor my code in module to look simpler? Thank you
2006 Apr 18
2
Connecting to multiple databases with multiple database users
Hi everyone,
I was wondering what the common practice for handling multiple db
users with fine grained privileges on multiple databases is. Against
the often read guideline for rails users to keep with a single db as
"more dbs don''t really make sense anyway", my opinion is that it DOES
make sense to use more than one db schema for a number of reasons that
I won''t
2007 Mar 06
2
Rails 1.2.2 upgrade problem
I was upgrading today from 1.1.2 to 1.2.2.
When I attempt to run the ruby script/server process now, I get the
errors below. I have looked through the
source files, but nothing obvious. The problem may be a constant which
now requires an explicit ''require filename'',
but don''t know how to find that constant.
Any help would be appreciated!
Regards,
Don McClean
**
2007 Apr 04
4
joining across databases in a find statement with include (legacy db)
Hi,
I have a legacy database ''old'' and a new database ''new'' which rails
uses. I set up models using old with establish_connection(old), and
this works well, except for include:
class OldModel < ActiveRecord::Base
establish_connection(old)
end
class NewModel < ActiveRecord::Base
has_one :old_model
end
a = OldModel.find :first
NewModel.find(:all,
2006 Nov 17
5
configure a rails app for multiple databases
Hello Rails community
I cannot seem to find via Google what I had hoped would be
a simple issue
On a single DB system (currently, postgres 8.1.4),
I have two databases, each containing multiple tables.
I would like to configure my app and database.yml to recognize
these two databases.
What is the corrrect config for the database.yml ?
Is it something like:
> production:
> adapter:
2009 May 21
1
DB connection problem in production
I have a separate DB for one model in my application and in development
mode the connection is working properly, in production however it isn''t.
production:
adapter: mysql
host: myhost
username: root
password:
database: production_db
users_production:
adapter: mysql
host: myhost
username: root
password:
database: other_db
The model that connects to the other
2006 May 16
2
Dynamically choosing schema using one Model
Hi all,
is there a way in RoR to dynamically set the table to which the Model
must refer to? I''d like to create a sorta "dispatcher" that chooses the
table for the Model based on an HTTP/GET var. To put it in another way
my Model would be fed with data coming from different tables based on
this var passed from the querystring.
Thanks,
Lorenzo
--
Posted via
2006 Jul 22
3
Connection refused - connect(2)
Dear all,
Please help me in this regards,
I am using models to access LegacySchemas using
set_table_name and set_primary_key...
[code for model]
class CdDetails < ActiveRecord::Base
def self.find_data
set_table_name ''cd_details''
set_primary_key ''cd_label''
find (:first,
:select => "cd_label")
end
2006 Jun 19
4
share model definition
I want to share everything about a model except the db connection. Is
this a reasonable way to do it?
module NotebookDefinition
--
Posted via http://www.ruby-forum.com/.
2006 Jan 27
2
Multiple database read
I have to extract data from an odbc connection to another database and put
into a MySQL database so that my rails app can manipulate it. What would be
the best way to set that up? Would I put the connection info in a
controller, so that the controller method with open and close the
connection? Any thought?
--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory
2006 Mar 27
5
Accessing Session Object from a model
i realise that this goes against the basic idea of the MVC architecture,
but i''ve found myself in a situation where i need to get information
about the current user in a model & i''m not sure how to do it.
Basically, we have a product where each customer has their own profile
with data stored in a separate database. There are some tables in a
common
2010 Jan 26
6
Subclassing ActiveRecord::Base
First of all, sorry for the crossposting, but I put this into the Ruby
Forum first of all, but was pointed to this as a more appropriate
location.
I''m using ActiveRecord and ActiveSupport in a non-rails environment
to connect to multiple databases, and I''ve found the following (single
database) to cause me an error. Note that params is my database settings
and omitted for
2006 Jan 27
1
Multiple Database write question
I am working on reconfiguring an app that we are about to release to
work tighter with another app that we already have. Both of these
apps are going to share a single users database that stores the
general information about the user such as login, password, name,
email and so forth. They also have app specific stuff that is
attributed to the user that is stored in the app''s own