Class: RTM::AR::ActiveRecord

Inherits:
Engine
  • Object
show all
Includes:
TopicMapSystem
Defined in:
lib/rtm/activerecord.rb

Instance Method Summary collapse

Methods included from TopicMapSystem

#[], #create, #log, #migrate_database, #topic_maps

Methods included from RdbmsConfig

#connect, #connected?, #migrate_database

Constructor Details

#initialize(params) ⇒ ActiveRecord

Returns a new instance of ActiveRecord.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/rtm/activerecord.rb', line 64

def initialize(params)
  super

  config = @params[:config]
  case config
  when :existing
    # do nothing, reuse existing active_record connection
  when nil
    # use the existing or externally configured connection
    connect unless connected?
  when :memory
    # explicityly connect to the sqlite3 in-memory backend
    connect
  when ::ActiveRecord::Base
    # when it is a class which extends ActiveRecord::Base, use the connection of this one.
    # FIXME: this is not implemented yet.
  when Array
    connect *config
  when Hash
    connect config
  else
    # fall through, like :existing
  end
end