Module: Intersys::ActiveRecordEmulation::ClassMethods

Defined in:
lib/intersys.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes = nil) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/intersys.rb', line 45

def create(attributes = nil)
  if attributes.is_a?(Array)
    attributes.collect { |attr| create(attr) }
  else
    object = intersys_call("%New")
    attributes.each { |att,value| object.send("#{att}=", value) }
    object.save
    object
  end
end

#exists?(id) ⇒ Boolean

Returns:

  • (Boolean)


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

def exists?(id)
  exists_id(id)
end

#find(*args) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/intersys.rb', line 65

def find(*args)
  if args.size == 1
    return open(args.first)
  end
  warn "No idea, how to implement method find"
  nil
end

#find_by_sql(sql) ⇒ Object



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

def find_by_sql(sql)
  warn "Nop, no find_by_sql in Object interface"
  nil
end