Prev | Current Page 371 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

default_timezone = :utc
a = Account.find(1)
puts a.created_on #=> Tue Jun 05 22:09:44 UTC 2007
A complete discussion on date and time issues is outside of the scope of this book, but
I will say that it??™s worth spending a little time thinking about. The applications of today are
becoming more and more global, which, in turn, is causing us to make more and more global
decisions about how or why something should work the way it does. Many older systems
CHAPTER 7 ?–  WORKING WITH LEGACY SCHEMA 167
logged dates and times as local dates and times, because the applications that used the data
were expected to also run in that local time zone. Often, that is no longer the case, making
standards such as UTC a much more interesting option.
allow_concurrency
The allow_concurrency attribute, again set directly on the ActiveRecord::Base class, lets you
tell Active Record if it should use a connection for each thread or if it should simply use
a single shared connection for all threads. The default is false, which states that Active Record
should use a single shared connection for all threads.


Pages:
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383