Displaying 20 results from an estimated 26 matches for "remove_connection".
Did you mean:
remoteconnection
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 Jan 13
1
How to disconnect to a database????
...erence databases, so we do not pre-define our
database accesses in the database.yml file. In fact,
we are using the
ActiveRecord::Base.establish_connection() to connect
to our database, the function works perfectly.
However, while we try to disconnect our database
connection with
ActiveRecord::Base.remove_connection(), we find out
that the connection is not closed (the function seems
not to be working perfectly) and we are still
connected to the database and able to access to the
tables.
Can you please tell us, is there something we did
wrong? or it is a known problem?
and what should we do to disconnect a da...
2006 Jan 18
1
Helps!!!!! Rails database connection guru needed!!!!!!!
...ctionstored in
@connection of the adapter class. while a request is
send to the adapter,the adapter will sends the request
to the database via its variable @connection.But where
exactly the disconnection is done while we connect
ourself to another database???? As we can see in the
source code "remove_connection"
connectionspecification
def self.remove_connection(klass=self)
conn = @@defined_connections[klass]
@@defined_connections.delete(klass)
active_connections[klass] = nil
conn.config if conn
end
bascially, it removes the "table-linked-class" from
the class vari...
2006 Aug 13
1
establish_connection method
...t;database configuration does not specify adapter" end
adapter_method = "#{spec[:adapter]}_connection"
unless respond_to?(adapter_method) then raise AdapterNotFound,
"database configuration specifies nonexistent #{spec[:adapter]} adapter"
end
remove_connection
establish_connection(ConnectionSpecification.new(spec,
adapter_method))
end
end
there is case statement.
when spec is ConnectionSpecification, @active_connection_name is set by
name.
But I couldn''t find what the hack is ''name'' variable..
Do you ha...
2006 Jan 11
0
Connection problem with a generic-runtime-built ActiveRecord::Base
...o 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 connection via "remove_connection" of a
postgresql database that I connected with
"establish_connection"
This is the generic class I wrote:
class GenActRec < ActiveRecord::Base
def self.connectToPSQLDB( hostName, portNum, dbName,
user, pwd )
ActiveRecord::Base.establish_connection(:adapter
=> "pos...
2005 Dec 20
1
How do I close DB connections?
...stays idle. Of course, after 500
or so of these idle postgres processes running, the DB refuses
to let me make any more (and I can''t really add more to the
postgres.conf).
How do I make sure these connections get closed after each query?
I''m guessing it has something to do with remove_connection?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 08
4
unless connected? + multiple databases
Hello all.
I am still having fun with multiple databases. In this case it is the
unless connected? statement.
ActiveRecord::Base establishes a connection that is inherited by the
majority of my models. However one Model (Componentlog) that uses a
separate DB is coded as:
unless Componentlog.connected?
establish_connection(
:adapter => "oci",
:database =>
2007 Jan 12
2
Forking a process in Rails is messing up mongrel
I''m trying to run an external Ruby script from my Rails app.
To do this i''m using this function
def fork_with_new_connection(config, my_class = ActiveRecord::Base)
pid = fork do
begin
my_class.establish_connection(config)
yield
ensure
my_class.remove_connection
end
end
Process.detach(pid)
end
Then, within my controller I do this:
# fork a process
config = ActiveRecord::Base.remove_connection
fork_with_new_connection(config) {
@environment = (RAILS_ENV == ''development'') ? ''dev'' : ''...
2006 May 10
8
dynamic setting of username and password in database.yml
Hello
I''ve now read a lot about application-level authentication in Rails, but
I need to do database-level authentication.
The reason is that my database needs to have the current_user (database
current_user, not current_user defined in an ActiveRecord Model) set to
execute triggers for automatically updating audit tables. So it is not
enough to have a session check against a User
2007 Sep 03
11
MySQL has gone away
Hi,
in a production environment we are running into "MySQL server has gone
away" errors (see below) when we call rebuild_index in aaf. This happens
sporadically.
Any suggestions for what might be wrong or workarounds? I guess we try a
reconnect before we call rebuild_index?
Matthew
ActiveRecord::StatementInvalid (Mysql::Error: MySQL server has gone
away: SELECT count(*) AS
2006 Jun 20
1
Extracting a connection out of ActiveRecord::Base
Hi
I''m trying to use the Typo wordpress converter script, but it requires
that the wordpress database is accessible over the connection to the
Typo database.
To get around this, I''m trying to use ActiveRecord::establish_connection
(...) to get a connection object to run the raw SQL queries that Typo''s
wordpress converter uses on. It doesn''t work with Ruby
2006 May 08
0
ActiveRecord and refreshing column info
...once I set the table_name to ''table_a'',
ActiveRecord always returns table_a''s column info. I''ve tried the
following ActiveRecord methods to clear the info in column_names &
neither has worked
ActiveRecord::Base.reset_column_information
ActiveRecord::Base.remove_connection
Even after removing & then restablishing the connection, the
column_names method continues to return table_a''s columns.
So I''m obviously on the wrong track here. But I can''t find out where I
should be headed. Any ideas?
Thanks!
Versions being used:
Ruby 1.8.4
Ro...
2006 Jan 13
1
pointer to standalone ActiveRecord example?
I''m seeking pointers to example code (ideally complete, small
programs) in Ruby that use ActiveRecord without Rails.
An added bonus would be if they happen to connect to SQL Server, but
I''ll take what I can get. Mainly I just need a jump-start to using
ActiveRecord outside Rails.
Thanks much.
MT
2010 Jul 19
0
Forking and integration tests
...hought of many ideas and decided to go with forking 2
or more processes (from within the test code) in which I issue a get
request to my controller-action.
Setup: MySQL DB, Rails 2.3.5, Ruby 1.9.1, Shoulda and FactoryGirl.
Unfortunately this test code doesn''t do the trick.
When I try to remove_connection before forking and then
establish_connection inside the children processes, I don''t find data
when asserting.
When trying to use the same connection among the parent process and its
children, I get into a total mess (due to concurrent access to the db
connection).
Sample errors from diff...
2006 Mar 09
3
How to copy between databases?
I want to copy data from one database to another using rails. But, it seems
that rails only will talk to one database at a time. Is there a way around
this?
Any help would be greatly appreciated.
--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
--- E.Taft Benson
-------------- next part --------------
An HTML attachment was scrubbed...
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 the database.
So we decide to add some new methodes in order to
remove all link between rails and the database.
First, we added a new methode to the adapter, we are
using postgresql, the following code is wri...
2006 Jan 05
7
HOWTO: Combine fields from 2 two tables in 1 object
Hi all,
For a dropdownlist (showing "Company - FirstName Lastname'') I want to fill an
object @project_contacts with "Name" from table Companies and "Firstname" and
"Lastname" from table contacts. Any idea?
Regards,
Gerard.
--
"Who cares if it doesn''t do anything? It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2009 Oct 26
0
[PATCH node] Users can now work with remote libvirt hosts.
...connections = self.get_connection_list()
+ if connections.count(connection) is 0:
+ connections.append(connection)
+ self.__conf.set_list("/apps/virt-manager/connections/uris", gconf.VALUE_STRING, connections)
+ self.__conf.suggest_sync()
+
+ def remove_connection(self, connection):
+ connections = self.get_connection_list()
+ if connections.count(connection) > 0:
+ connections.remove(connection)
+ self.__conf.set_list("/apps/virt-manager/connections/uris", gconf.VALUE_STRING, connections)
+ self.__...
2009 Jan 13
9
Updating multiple databases at the same time
I have an application that is load balanced. I have a master database
which I update once a day. Then I push the raw mysql files to all other
servers so they are the same as the master. This works fine, but there
are a few situations where I need all databases to update in real-time.
What would be the best way to achieve this in rails?
Here is an example of what I am trying to do. I want to