61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/event_attribute.rb', line 61
def event_attribute(column, options = {})
unless respond_to?(:event_attribute_attrs)
class_attribute :event_attributes
class_attribute :event_attribute_attrs
self.event_attributes, self.event_attribute_attrs = {}, {}
end
attribute = (options[:attribute] || (column.to_s =~ /_at|_on/ ? column.to_s[0...-3] : raise("Unable to create default attribute name"))).to_sym
nil_equals = options[:nil_equals] || false
self.event_attribute_attrs[attribute] = column
self.event_attributes[column] = nil_equals
create_attribute_accessors(attribute, column, nil_equals)
end
|