Module: SequelAdapter::InstanceMethods

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



63
64
65
66
# File 'lib/models/sequel_adapter.rb', line 63

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
# File 'lib/models/sequel_adapter.rb', line 45

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

#update(attributes) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/models/sequel_adapter.rb', line 53

def update(attributes)
  @instance.set attributes
  if @instance.valid?
    @instance.save
    true
  else
    false
  end
end

#validObject



49
50
51
# File 'lib/models/sequel_adapter.rb', line 49

def valid
  @instance.valid?
end