Module: DmAdapter::InstanceMethods

Defined in:
lib/models/dm_adapter.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



56
57
58
59
# File 'lib/models/dm_adapter.rb', line 56

def method_missing(meth, *args, &block)
  #cool I just found out * on an array turns the array into a list of args for a function
  @instance.send(meth, *args, &block)
end

Instance Method Details

#errorsObject



45
46
47
48
49
# File 'lib/models/dm_adapter.rb', line 45

def errors
  @instance.errors.collect do |k,v|
    "#{k} #{v}"
  end.join(', ')
end

#update(attributes) ⇒ Object



51
52
53
54
# File 'lib/models/dm_adapter.rb', line 51

def update(attributes)
  @instance.update attributes
  #self
end

#validObject



41
42
43
# File 'lib/models/dm_adapter.rb', line 41

def valid
  @instance.valid?
end