Module: ArAdapter::InstanceMethods

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



61
62
63
64
# File 'lib/models/ar_adapter.rb', line 61

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



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

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

#savedObject



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

def saved
  @instance.valid?
end

#update(attributes) ⇒ Object



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

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

#validObject



42
43
44
# File 'lib/models/ar_adapter.rb', line 42

def valid
  @instance.valid?
end