module Surbase::Model

Public Class Methods

load( model, where, data = nil ) click to toggle source
# File lib/surbase/model.rb, line 3
def self.load( model, where, data = nil )
  record = model.where( where ).first
  if ! data.nil?
    record.nil? ? record = model.new( data ) : record.attributes = data
  end
  record
end