module TimeJawn::ClassMethods

Defines methods that will attached to all ActiveRecord classes.

Attributes

time_zone_attribute_name[R]

Public Instance Methods

has_time_zone(options_hash = {}) click to toggle source

When called it loads the methods located in InstanceMethods. It is typically included in a model's rb file so that instances of that class gain the InstanceMethods at each instantiation.

class Event<ActiveRecord::Base
  has_time_zone
end

Optionally you may pass the name of your time zone attribute in as a symbol.

class Event<ActiveRecord::Base
  has_time_zone   named: :this_is_my_time_zone
end
# File lib/time_jawn/time_jawn.rb, line 31
def has_time_zone(options_hash = {})
  set_instance_variables(options_hash)
  send(:include, InstanceMethods)
end