You are here: Browse Railsplugins Apply Timezone To
== When we have date/time values that are sensitive to timezones, and we wish to only store GMT date/time in databases, the usual routine is to:
Instead of doing all these, just use
apply_timezone_to [:commence_at, :terminate_at]
This will make ‘commence_at’ and ‘terminate_at’ store GMT values in database, but work with timezone values everywhere else. The statement above assumes column ‘timezone’ contains the timezone string, e.g. ‘Asia/Singapore’. To specify your custom column, simply append to the declaration:
apply_timezone_to [:commence_at, :terminate_at], :tzname
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly