similar to: joining across databases in a find statement with include (legacy db)

Displaying 20 results from an estimated 300 matches similar to: "joining across databases in a find statement with include (legacy db)"

2008 Jul 28
1
callback executed like after_save but after transaction
I''m trying to add some code for my ActiveRecord class so that it is executed whenever an object is updated, this code is a seperate process that reads from the same table represented by my model class so when it runs it needs the database to be up to date. In the following situation this is fine: # MyModel def after_save `/usr/local/bin/update_models -i #{self.id}` end # controller
2007 Dec 15
2
Reading Model data before update
Hi all, here is the challenge: I have this validation method, that basically prevents an object which billed = true to be updated: def before_update if read_attribute(:billed) errors.add_to_base(''This service has already been billed for'') end !read_attribute(:billed) end The above code does not work in case I do something like: object =
2018 Oct 15
0
UPS BZ1500PBI-BR (Microsol - Brazil) Compatibility.
Hello, I've been trying to set this UPS up on a Synology NAS DS218+ which uses NUT, and even though they are using NUT, they don't have all drivers available as NUT has them at NUT's website. Please see that below: root at DSAltaCloud:/usr/syno/etc/ups# upsdrvctl start Network UPS Tools - UPS driver controller DSM6-2-1-newmodel-repack-23796-180722 Network UPS Tools - Generic HID
2006 Feb 08
8
Strategies for Unit testing 2 databases
Hi, My application spans 2 (or more) databases for some very specific reasons... My models are working fine, even dynamically establishing connections as needed at runtime, and spanning relationships across the databases (which really impressed me). The problem is, I can''t seem to force Units for these models (that use a secondary db) to load their fixtures into and use the
2006 Mar 16
5
Multiple databases + switching databases
Hello, I have an application that access two different DBMS - Firebird and Postgres. So far, that''s ok. The problem is, depending on the customer logged, a different database (Firebird) must be selected. To make the things clearer: Postgres: 1 database shared by all customers with these tables: - user - vehicle - driver Firebird: several databases with different names and identical
2012 May 15
5
setting up the SQLite database
I know this isn''t Python, but I''d like to get a view on the ''one obvious'' way to set up an SQLite (or other) database and its location per-app. I''ve got a bit lost with the Camping 2 changes and various code snippets I have kicking around. 1. is it best to set up the DB creation/connection: 1.1 at the end of the app
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 May 15
8
Databases... write master, multiple read-only slaves.. will this work?
Hi all - I have a need to have my models write to one database and read from another. From what I''ve read, Rails doesn''t do this out of the box. I came up with something that does work, but I''m wondering if there is something I''m missing in the code below that''s going to bite me, such as establish_connection creating a huge number of objects as
2012 Jul 17
6
Database connection parameters are tied to the filesystem
HI Guys, I recently tried VERY hard to override the database configuration bassed on ENV vars or actual API calls. This task is almost next to impossible. I know that the database.yml file is parsed as ERB but that is sane for simple ENV replacement if you want to actually change which database adaptor it is (requires extra config/params) it becomes messy. I found
2006 Aug 13
1
establish_connection method
I''m digging into rails source code. But I''ve got a problem in undestading actionrecord::base source code which is connection_specification.rb. In the body of establish_connection method, def self.establish_connection(spec = nil) case spec when nil raise AdapterNotSpecified unless defined? RAILS_ENV establish_connection(RAILS_ENV)
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 24
4
Parse request URL.
Hello all. Due to the mistakes of the company before I joined ;) I am stuck with a multiple database setup. I am planning on parsing the REQUEST_URL to decide which controller is being accessed and basing the establish_connection on that. Before I go messing around with regexps I was wondering if rails has a built in function for parsing URLS. I have googled around a bit and seen net/http
2006 Feb 27
5
Database connections...so many connections!
Hello all. I am currently running a very simple ruby app. It connects to an Oracle server using the OCI8 adapter. I have two controllers, each one connects to a different schema on the server, I looked at the WIKI that had details of multiple database connections (http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases), I moved the code from the application controller into each
2006 Oct 12
2
Too Many Mysql connections
In my app, for three models: foo,bar and baz, the database connection is made to a different database and hence in model code: class Foo < ActiveRecord::Base establish_connection :diff_database end class Bar < ActiveRecord::Base establish_connection :diff_database end class Baz < ActiveRecord::Base establish_connection :diff_database end Now, the problem is, if is use the above
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:
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
2009 Oct 28
2
What's the simplest way to use ActiveResource in ruby (without rails)?
I would like to use this class in a standalone project, but I have been unsuccessful thus far. Also, how does this class exactly communicate with the web server? Thank you. class Person < ActiveResource::Base self.site = "http://localhost:3000/" end
2009 Jan 13
2
Connect multiple DB in rails project using AR
Dear all I have a rails project which database connection is defined in database.yml. There is a table call "servers" which have about 40 records, which is a collection of database setting (i.e. Server.name, Server.port, Server.host) I know the way to establish multiple connection as below... class A < ActiveRecord::Base end A.establish_connection(a) # a is the database config
2013 Jan 20
6
preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr
Greetings, I''m getting this - ActiveModel::MissingAttributeError: missing attribute: some_attr - on a random basis under a unicorn server, running rails 3.2 and ruby 1.9.3 As the case of the last poster in the following thread - https://github.com/rails/rails/issues/1906 - I too am able to resolve this issue by settingpreload_app to false. However, this is not the behaviour I want to
2007 Jan 22
4
Postamble vs campingrc
Hi, Should I be able to use the Webrick postamble instead of using .campingrc, to tell Camping I want to use mysql? It doesn''t seem to be working for me. It does work however, when I''m using FastCGI (establish_connection :adapter => ''mysql''). James