Class: ActiveRecord::Base

Inherits:
Object show all
Defined in:
lib/clevic/sequel_ar_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attribute_namesObject



112
113
114
# File 'lib/clevic/sequel_ar_adapter.rb', line 112

def self.attribute_names
  ( column_names + reflections.keys.map {|sym| sym.to_s} ).sort
end

.has_attribute?(attribute_sym) ⇒ Boolean

checks to see if attribute_sym is either in the column name list, or in the set of reflections.

Returns:

  • (Boolean)


102
103
104
105
106
107
108
109
110
# File 'lib/clevic/sequel_ar_adapter.rb', line 102

def self.has_attribute?( attribute_sym )
  if column_names.include?(  attribute_sym.to_s )
    true
  elsif reflections.has_key?(  attribute_sym )
    true
  else
    false
  end
end

Instance Method Details

#adaptorObject



116
117
118
# File 'lib/clevic/sequel_ar_adapter.rb', line 116

def adaptor
  @adaptor ||= Clevic::ActiveRecordAdaptor.new( self )
end