Skip to content
This repository

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…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 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.