Module: TimeJawnPrivateClassMethods

Included in:
TimeJawn::ClassMethods
Defined in:
lib/time_jawn/time_jawn_private_class_methods.rb

Overview

Defines private methods necessary for TimeJawn to work.

Instance Method Summary collapse

Instance Method Details

#_datetime_attributesObject

Locates all of an ActiveRecord class’ DateTime Attributes and returns them as an array of symbols.



4
5
6
7
8
9
10
11
12
13
# File 'lib/time_jawn/time_jawn_private_class_methods.rb', line 4

def _datetime_attributes
  ActiveSupport::Deprecation.warn "_datetime_attributes will be made private in a future version."
  klass = name.constantize

  datetime_attributes = []
  klass.columns.each do |column|
     datetime_attributes << column.name.to_sym if column.type == :datetime
  end
  return datetime_attributes
end