Prev | Current Page 307 | Next

David Berube

"Practical Reporting with Ruby and Rails"

yml file,
# read from that . . .
if File.exists?('./config/database.yml')
require 'yaml'
ActiveRecord::Base.establish_connection(
YAML.load(File.read('config/database.yml'))['development']
)
CHAPTER 11 n TRACKING THE NEWS WITH GOOGLE NEWS 222
else
# . . . otherwise, connect to the default settings.
# Note that if don't you have the default MySQL settings below,
# you should change them.
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "your_mysql_hostname_here",
:username => "your_mysql_username_here",
:password => "your_mysql_password_here",
:database => "company_pr")
end
If you run the script from the root of a Rails application, the information from the
config/database.yml file and the parameters for the development environment are loaded.
If not, it manually creates the connection with the default parameters. Note that you can
change ['development'] to ['production'] on the first establish_connection line if you
would prefer to use the connection parameters from the production environment.


Pages:
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
prezenty 2 1 Futro Teksty piosenek hotele