Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/verd/active_record_base.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.model_validityObject

Returns the value of attribute model_validity.



3
4
5
# File 'lib/verd/active_record_base.rb', line 3

def model_validity
  @model_validity
end

.source_locationObject

Returns the value of attribute source_location.



3
4
5
# File 'lib/verd/active_record_base.rb', line 3

def source_location
  @source_location
end

Class Method Details

.human_attribute_namesObject



12
13
14
# File 'lib/verd/active_record_base.rb', line 12

def human_attribute_names
  attribute_names.each_with_object({}){ |attr, h| h[attr] = human_attribute_name(attr) }
end

.source_dirObject



5
6
7
8
9
10
# File 'lib/verd/active_record_base.rb', line 5

def source_dir
  return @source_dir if @source_dir
  path = name.split(/::/)
  path.pop
  @source_dir = "/#{path.map(&:underscore).join('/')}"
end

.verd_columnsObject



16
17
18
# File 'lib/verd/active_record_base.rb', line 16

def verd_columns
  columns.map{|c| "#{c.name} : #{c.sql_type}"}
end

.verd_indexesObject



20
21
22
23
# File 'lib/verd/active_record_base.rb', line 20

def verd_indexes
  connection.indexes(table_name).sort_by(&:columns).
    map{|idx| {cols: idx.columns, uniq: idx.unique} }
end