similar to: using AR outside of rails

Displaying 20 results from an estimated 10000 matches similar to: "using AR outside of rails"

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 Apr 20
2
index_dir path
Hi, I am running several applications, and I need them to share their indexed data. So instead of putting my index in the default location of RAILS_ROOT/index/RAILS_ENV I want it to appear in RAILS_ROOT/../index/RAILS_ENV (ie in the parent directory of each of my root directories ... I have three apps working together) In the acts_as_ferret file, I have changed line 73 to: index_base =
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 Jun 26
1
Separate Read and Write Database
Hello, I need to access an mirrored database with one read and one write cluster. Is there a way to tell a model to use two connections? So that all updates etc go to the write database and all read from the read one? This is a fixed set up I can not use MySQL 5.x stuff and additionally i get a token on write, which can be checked on read (and wait for replication) if new data is needed. I
2013 May 14
4
rake precompile:assets throwing error
While running rake precompile:assets i''m getting the following error This is the error message: rake assets:precompile:all RAILS_ENV=production rake aborted! undefined local variable or method `establish_connection'' for ActiveRecord::Base:Class Please help -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To
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
2007 Sep 12
3
Can''t disable ferret when running in Mongrel
In my environment.rb I say the following: MyModel.disable_ferret puts MyModel.ferret_enabled? The console works as expected: script/console false >> MyModel.ferret_enabled? => false I can then edit an instance, ferret remains disabled and the changes are not immediately indexed. However, when I start mongrel Ferret is initially disabled, but then somehow becomes enabled again
2006 May 04
1
Multiple database problem in rails 1.1 ?
Hi ... We are constructing at rails GUI using two differant databases, and this seems to work out nicely using a "establish_connection" per model, where each model enherit directly from ActiveRecord::Base. But ! I like to use a model where we can inherit from one parent class that handles the connection exactly as descripted in this document :
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
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 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/.
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
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 Dec 01
4
uninitialized constant error in app but not when using console
I''ve got a wierd issue here and maybe someone can assist i created a module in my apps lib directory which i use for authenticating against an external source (among other things). lib/myapp.rb ----------------- require ''rubygems'' require_gem ''activerecord'' # uses activerecord odbc adapter by openlink module MyApp module ExternalSource class
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
2006 Nov 20
4
Production RAILS_ENV / DB Selection
Hey all, I''m having some issues moving a project that incorporates Backgroundrb onto a staging server... For some reason (surely of my own doing), my RailsBase workers are insisting on using trying to access my development DB instead of my "production" DB. When I try to load a model object from within a worker, I get the following: 20061120-21:54:28 (26296)
2006 Oct 28
4
Mounting an app as ''/'' under Apache?
Hello everyone, I have a site with a collection of camping apps. I''m trying to force one of them, blog.rb, to run as the index (''/''). I think that I understand the RDoc as stating that I can execute the following to make that happen: Camping::FastCGI.serve File.expand_path(current), Blog But, when doing so, I recieve the following error: Camping
2007 Mar 13
1
Using ActiveRecord outside of Rails error
Hi, I have a script which is using ActiveRecord for database queries outside of a rails app. It seems to work fine for doing finds on models, but everytime I try to create a new model object and then save it, I always get the error: MyModel.new({:name=>''foo''}).save gives NoMethodError: undefined method `read_inheritable_attribute'' for #<MyModel:0x251f7d8>
2010 Oct 02
2
Unicorn doesn't reload the app after the HUP signal
Hi folks, I''ve experimented a problem while deploying my app, I''ve sent the HUP signal to the master process, I''ve checked everything is ok: new master and workers are spawned and the old ones are killed(I''ve checked the PIDs), but the new code deployed isn''t reflected in the living site, so I''ve to stop and start again unicorn in order to see
2006 Jul 12
10
Rails: Good for everything?
My department is in a battle right now. We have some very por PHP people and very pro Rails people. The php guys make a good argument that Rails is good for new applications where we dictate the DB schema. PHP shines where we go into an existing application, or a new one where multiple databases or possibly legacy systems are involved. The PHP guys basically say Rails is good for Web 2.0