Module: MmAdapter::InstanceMethods

Defined in:
lib/models/mm_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



60
61
62
63
# File 'lib/models/mm_adapter.rb', line 60

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



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

def errors
  @instance.errors.full_messages.join(', ')
end

#savedObject



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

def saved
  @instance.valid?
end

#update(attributes) ⇒ Object



47
48
49
50
# File 'lib/models/mm_adapter.rb', line 47

def update(attributes)
  @instance.update_attributes attributes
  @instance.save
end

#validObject



43
44
45
# File 'lib/models/mm_adapter.rb', line 43

def valid
  @instance.valid?
end