lib/rest/rest.rb in active-orient-0.5 vs lib/rest/rest.rb in active-orient-0.6
- old
+ new
@@ -51,11 +51,11 @@
*USECASE*
xyz = ActiveOrient::Model.orientdb = ActiveOrient::OrientDB.new
initialises the Database-Connection and publishes the Instance to any ActiveOrient::Model-Object
=end
- def initialize database: nil, connect: true, preallocate: true
+ def initialize database: nil, connect: true, preallocate: true, model_dir: nil
self.logger = Logger.new('/dev/stdout') unless logger.present?
# self.default_server = {
# :server => 'localhost',
# :port => 2480,
# :protocol => 'http',
@@ -68,11 +68,12 @@
@res = get_resource
connect() if connect
database_classes # initialize @classes-array
ActiveOrient::Model.orientdb = self
ActiveOrient::Model.db = self
- preallocate_classes if preallocate
+ ActiveOrient::Model.keep_models_without_file ||= nil
+ preallocate_classes(model_dir) if preallocate
end
def get_resource
login = [ActiveOrient.default_server[:user].to_s , ActiveOrient.default_server[:password].to_s]
@@ -97,10 +98,10 @@
end
rescue RestClient::Unauthorized => e
if first_tentative
logger.info{"Database #{database} NOT present --> creating"}
first_tentative = false
- create_database
+ create_database database: database
retry
else
Kernel.exit
end
end