Displaying 20 results from an estimated 3000 matches similar to: "Fake ActiveRecord model?"
2006 Mar 17
3
Timestamps casted to nil?
Hi,
for some reason, all timestamp fields with or without time zone in my
Postgres tables seem to be casted to nil. From console:
>> me = User.find(''PS12345'')
=> #<User:0x2379788 @attributes={"mtime"=>"01.03.2006 13:26:32.737166",
"valid"=>"8", "valid_from"=>"01.03.1999 14:09:21 CET",
2006 Mar 01
7
Oracle Sequence & Rails
the compiler tell me it:
invalid column name: INSERT INTO ago.prova_stats (cognome, nome, id,
telefono) VALUES(''Medda'', ''Ivan'', :id, 70565611)
where ago.prova_stats is the table used by me and that have only the
columns ''cognome'',''nome'' and ''telefono''.
My table hasn''t the column
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 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,
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 Mar 13
6
comparing two databases with Active Record.
I have two databases in SQLite with the same schema. The other
database was populated by an external
customer and then returned. I want to use ActiveRecord to do the
comparison.
I am not sure of the best way to access the tables in each database
with ActiveRecord models. I could
change the connection dynamically whenever I want to switch between
the databases, but this would seem to be clumsy
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
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
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
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 Mar 14
4
ruby-postgres: can''t convert string to integer
Hi everybody,
I''m experiencing trouble when trying to use ruby-postgres with a legacy
database I need access to. To me it seems the problem is the VARCHAR
columns used there as primary keys. On a simple
me = User.find(''PS12345'')
I get a type error exception with the message ''can''t convert String into
Integer''. The trace is:
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:
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