[Ovirt-devel] [PATCH] use 'production' Rails Environment by default

Mohammed Morsi mmorsi at redhat.com
Tue Sep 23 15:54:37 UTC 2008


Scott Seago wrote:
> Alan Pevec wrote:
>> Signed-off-by: Alan Pevec <apevec at redhat.com>
>> ---
>>  src/dutils/active_record_env.rb |   16 +++++++++-------
>>  1 files changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/dutils/active_record_env.rb
>> b/src/dutils/active_record_env.rb
>> index 17f7c25..c6f37eb 100644
>> --- a/src/dutils/active_record_env.rb
>> +++ b/src/dutils/active_record_env.rb
>> @@ -39,14 +39,16 @@ require
>> "#{OVIRT_DIR}/vendor/plugins/betternestedset/init.rb"
>>  require "#{OVIRT_DIR}/vendor/plugins/acts_as_xapian/lib/acts_as_xapian"
>>  
>>  def database_connect
>> -  $dbconfig =
>> YAML::load(ERB.new(IO.read("#{OVIRT_DIR}/config/database.yml")).result)
>> -  $develdb = $dbconfig[ENV['RAILS_ENV']]
>> +  yml =
>> YAML::load(ERB.new(IO.read("#{OVIRT_DIR}/config/database.yml")).result)
>> +  rails_env = ENV['RAILS_ENV']
>> +  rails_env = 'production' unless rails_env
>> +  dbconfig = yml[rails_env]
>>    ActiveRecord::Base.establish_connection(
>> -                                          :adapter  =>
>> $develdb['adapter'],
>> -                                          :host     =>
>> $develdb['host'],
>> -                                          :username =>
>> $develdb['username'],
>> -                                          :password =>
>> $develdb['password'],
>> -                                          :database =>
>> $develdb['database']
>> +                                          :adapter  =>
>> dbconfig['adapter'],
>> +                                          :host     =>
>> dbconfig['host'],
>> +                                          :username =>
>> dbconfig['username'],
>> +                                          :password =>
>> dbconfig['password'],
>> +                                          :database =>
>> dbconfig['database']
>>                                            )
>>  end
>>  
>>   
> Looks good to me. Solves the RAILS_ENV problem and renames the vars to
> be more descriptive.
>
> ACK, since apevec has already verified that this works without
> RAILS_ENV being set.
>
> Scott
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel
ACK as well. Just finished testing with default production environment
and autobuild generated test environment.

   -Mo




More information about the ovirt-devel mailing list