Module: AggtiveRecord::Aggable::ClassMethods
- Defined in:
- lib/aggtive_record/aggable.rb
Instance Method Summary collapse
Instance Method Details
#attr_timestamp(attname) ⇒ Object
10 11 12 13 |
# File 'lib/aggtive_record/aggable.rb', line 10 def (attname) raise ArgumentError unless is_a_datetime?(att) self.datetime_attribute = attname end |
#is_a_datetime?(attname) ⇒ Boolean
15 16 17 |
# File 'lib/aggtive_record/aggable.rb', line 15 def is_a_datetime?(attname) self.columns.select{|r| r.name == attname.to_s && r.type =~ /date|time/}.first.present? end |