Module: Lokap::Trackable::TableUtilities

Included in:
Base
Defined in:
lib/lokap/trackable/table_utilities.rb

Instance Method Summary collapse

Instance Method Details

#trackable_class_name(class_name = nil) ⇒ Object



13
14
15
16
# File 'lib/lokap/trackable/table_utilities.rb', line 13

def trackable_class_name(class_name=nil)
  return class_name.classify unless class_name.nil?
  "Activity".classify
end

#trackable_method?(method) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/lokap/trackable/table_utilities.rb', line 4

def trackable_method?(method)
  method.to_s.split('_').first == 'trackable'
end

#trackable_table_name(class_name = nil) ⇒ Object



8
9
10
11
# File 'lib/lokap/trackable/table_utilities.rb', line 8

def trackable_table_name(class_name=nil)
  return class_name.tableize unless class_name.nil?
  [arel_table.name.singularize, "activities"].join('_')
end