Class: FastExt::MModel

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_ext/m_model.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ MModel

Returns a new instance of MModel.



6
7
8
# File 'lib/fast_ext/m_model.rb', line 6

def initialize(model)
  @model = model
end

Class Method Details

.allObject



18
19
20
# File 'lib/fast_ext/m_model.rb', line 18

def self.all
   @@models ||= ::ActiveRecord::Base.subclasses.map {|ar| MModel.new(ar)}
end

.find(class_name) ⇒ Object



22
23
24
# File 'lib/fast_ext/m_model.rb', line 22

def self.find(class_name)
  all.detect {|m| m.class.to_s == class_name.to_s }
end

Instance Method Details

#columnsObject



14
15
16
# File 'lib/fast_ext/m_model.rb', line 14

def columns
  @model.columns
end

#nameObject



10
11
12
# File 'lib/fast_ext/m_model.rb', line 10

def name
  @model.to_s
end