similar to: including database in set_table_name

Displaying 20 results from an estimated 30000 matches similar to: "including database in set_table_name"

2006 Jan 11
0
Connection problem with a generic-runtime-built ActiveRecord::Base
Hi, I''m trying to create a "runtime-generic" ActiveRecord class, It means I don''t need to know the table or database, before I create my program ruby-rails. So I don''t need to predefine my database in environment.yml file and pre-build classes inherited from ActiveRecord::Base. I write some code, it seems to work. However, I can''t disconnect my
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 Jan 26
0
If you want to disconnect a database properly, there is the code:)!!!
Hi, We have worked on a problem of connection: Connect to two databases with a single ActiveRecord::Base model class within the same action The main difficulty is how to disconnect the actual connection properly and then let the ActiveRecord establishes a new one. The actual function "remove_connection" removes the connection, but its doesn''t unbind the link between rails and
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
2006 Jun 14
0
Mssql Multiple Database Access Error
Hi All, I am having a problem to access multiple databases with mssql I am running Ruby 1.8.4 and Rails 1.1 on Windows 2000 Advanced Server. I am simply trying to integrate the application I wrote before for Oracle to Mssql. The application works perfectly with Oracle with the installed driver OCI8. The app retrives data based on a search criteria from those databases. I followed the directions
2009 Apr 16
0
Magic multi connections with association problem
Dear all I am using magic multi connections, there is some problem when using association. How can I dynamic determine the module name (i.e. A::Request, B::Request) in activerecord association. Below is my code: module A establish_connection :A end module B establish_connection :B end # and many module.... class Request < ActiveRecord::Base set_table_name "request"
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 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
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
2007 Jan 14
2
rspec and set_table_name?
Hi there I have a Value class in my Rails app; however ''values'' is a reserved word in MySQL so in my value.rb file, I''ve declared set_table_name as ''vals''. However, in setting up my specs for this model, I''m hitting errors that seem to be resulting from rspec not seeing the set_table_name declaration in my model file. For instance,
2006 Mar 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables on the fly for accessing archive data? If I could access sessions inside a model I would do something like: if @session[:current_period] set_table_name "statistics_" + @session[:archive_year] else set_table_name "statistics_" + Date.now.year end But since I cannot access the session from within a
2009 Mar 18
1
set_table_name woes, fragmented domain class
Hi all, I''m running Rails on top of a Mongrel cluster. I have several model classes that are going to have so many records it is not feasible to keep them all in the same table. So I''ve split out the records into many different tables, each with its own suffix which corresponds to the id of the model to which all records in that particular table belong. For example,
2008 Jun 19
0
Error loading fixtures with classes that set_table_name
Hi all, I just hit a big wall involving a legacy database. I''ve got an active record class called "School" that uses "set_table_name ''old_school''" to map to a legacy database table: class School < ActiveRecord::Base set_table_name ''old_school'' end It works great, until I''m testing and I want to use fixtures.
2008 Jun 23
0
Error loading fixtures for classes that set_table_name
Hi all, I just hit a big wall involving a legacy database. I''ve got an active record class called "School" that uses "set_table_name ''old_school''" to map to a legacy database table: class School < ActiveRecord::Base set_table_name ''old_school'' end It works great, until I''m testing and I want to use fixtures.
2009 Feb 25
1
Problem with set_table_name
Dear friends, I ran the following in my console.Assume I already have the postgresql connection . >> class D < ActiveRecord::Base >> end => nil >> D.set_table_name "users" => nil >> D.column_names => ["id", "name", "fname", "lname", "password", "addr1", "addr2",
2007 Nov 29
2
railroad-database problem
Hi all, I am facing with a new type of problem with railroad, explained below 1. I am using an oracle database in my application. In the database.yml file, I am having different schema connections to the same database.like development: database: real_database username: schema_name1 password: ************ adapter: oracle abcd_development: database: real_database
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,
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 Jan 18
1
Helps!!!!! Rails database connection guru needed!!!!!!!
Hi, I really need help to understand what is happening while Rails connect to a database, (we area actually using postgresql, so my example will be with postgresql) What I understand is Rails is able to connect to different DB. Actually, this is what we want, and we have made some tests, everything is juste fine. However, all these tests lead us to some important questions that we did find the
2006 May 15
8
set_table_name and self.table_name
I have some legacy tables that I used set_table_name on, I''m attempting to write a method that will get key value from a sequence table and then update it and return a value. I''m hoping to put this in the base ActiveRecord method so I would like to reference the table name with self.table_name or something... class Contacts < ActiveRecord::Base set_table_name