Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ActiveRecord::Base.establish_c onnection in development and production envs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nikolay Burlov  
View profile  
 More options Jul 19 2011, 2:45 am
From: Nikolay Burlov <kohg...@gmail.com>
Date: Mon, 18 Jul 2011 23:45:32 -0700 (PDT)
Local: Tues, Jul 19 2011 2:45 am
Subject: ActiveRecord::Base.establish_connection in development and production envs
Hi, guys!

Background:
I've resque workers in my application. These workers do several jobs
that associated with DB. In development environment, I've no need to
provide some additional configuration for db, they are use development
database. But then I switching to production env, I set
ActiveRecord::Base.establish_connection with my production DB
parameters.

Problem:
When I'm switch back to development env, I've to comment
ActiveRecord::Base.establish_connection every time. Hope, anybody can
help me and provide a better approach for this situation.

Sincerely,
Nikolay Burlov.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hassan Schroeder  
View profile  
 More options Jul 19 2011, 10:22 am
From: Hassan Schroeder <hassan.schroe...@gmail.com>
Date: Tue, 19 Jul 2011 07:22:18 -0700
Local: Tues, Jul 19 2011 10:22 am
Subject: Re: [Rails] ActiveRecord::Base.establish_connection in development and production envs

On Mon, Jul 18, 2011 at 11:45 PM, Nikolay Burlov <kohg...@gmail.com> wrote:
> I've resque workers in my application. These workers do several jobs
> that associated with DB. In development environment, I've no need to
> provide some additional configuration for db, they are use development
> database. But then I switching to production env, I set
> ActiveRecord::Base.establish_connection with my production DB
> parameters.

> Problem:
> When I'm switch back to development env, I've to comment
> ActiveRecord::Base.establish_connection every time.

Can't you just wrap that in a conditional statement based on the
environment, e.g.

if Rails.env  == "production"
    ActiveRecord::Base.establish_connection(option_hash)
end

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kohgpat@gmail.com  
View profile  
 More options Jul 19 2011, 12:26 pm
From: "kohg...@gmail.com" <kohg...@gmail.com>
Date: Wed, 20 Jul 2011 01:26:06 +0900
Local: Tues, Jul 19 2011 12:26 pm
Subject: Re: [Rails] ActiveRecord::Base.establish_connection in development and production envs

Yeah, I've thought about this. But I wasn't sure that this approach is best.

Thank you!

Sincerely,
Nikolay Burlov.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »