- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
class CheckDatabaseYmlEncoding < ActiveRecord::Migration
def self.up
config = Rails::Configuration.new
['development', 'production' ].each { |env|
db_config = config.database_configuration[env];
if db_config
if db_config['encoding'] != 'utf8'
msg = "please use encoding: utf8 in database.yml's #{env} configuration"
Rails.logger.error(msg)
raise msg
else
Rails.logger.info("database.yml's #{env} configuration is using encoding: utf8. Good !" )
end
else
Rails.logger.error("#{env} is missing in database.yml" )
end
}
end
def self.down
end
end
Fester 27.10.2011 18:19 # +6
Lure Of Chaos 27.10.2011 18:28 # +5
Fester 27.10.2011 18:35 # 0
Lure Of Chaos 27.10.2011 18:36 # 0
roman-kashitsyn 27.10.2011 18:35 # +3
Fester 27.10.2011 18:41 # +1
gegMOPO4 27.10.2011 18:47 # 0
tir 27.10.2011 19:58 # +1
guest 28.10.2011 18:42 # +3
guest 29.10.2011 16:16 # 0
guest8 09.04.2019 11:50 # −999
COMHPiI 25.08.2021 02:32 # 0