Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
This is a (very) simple plugin to simplify the usage of time zones in Rails applications.

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
MIT-LICENSE
README
Rakefile
init.rb

README

HasScopedTimeZone
=================

This is a (very) simple plugin to simplify the usage of time zones in Rails applications.

Example
=======

  class Product < ActiveRecord::Base
    has_scoped_time_zone :created_at, :updated_at, lambda { |product| product.owner.time_zone }
  end

Will create the methods created_at_tz and updated_at, each one returning the date and time in the product's owner time zone.

  class Owner < ActiveRecord::Base
    has_scoped_time_zone lambda { |owner| owner.time_zone }
  end

Creates a new *_tz method for every datetime column in the Owner table scoped to its time_zone attribute value.

Feedback? Bugs? Drop me a line: miloops at gmail dot com.

Copyright (c) 2008 Emilio Tagua, released under the MIT license
Something went wrong with that request. Please try again.