Module: RawgentoModels

Defined in:
lib/rawgento_models.rb,
lib/rawgento_models/order.rb,
lib/rawgento_models/version.rb,
lib/rawgento_models/supplier.rb,
lib/rawgento_models/order_item.rb,
lib/rawgento_models/stock_item.rb,
lib/rawgento_models/local_product.rb,
lib/rawgento_models/remote_product.rb

Defined Under Namespace

Classes: LocalProduct, Order, OrderItem, RemoteProduct, StockItem, Supplier

Constant Summary collapse

MIGRATION_PATH =

When required, provide migrations.

File.expand_path(File.join __dir__, '..', 'db', 'migrate')
CONF_FILE =
"db/config.yml"
VERSION =
"0.4.1".freeze

Class Method Summary collapse

Class Method Details

.establish_connection(config_file_path = CONF_FILE) ⇒ Object

Reads config and wires up AR



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rawgento_models.rb', line 23

def self.establish_connection(config_file_path=CONF_FILE)
  config = OpenStruct.new YAML.load_file(config_file_path)
  ActiveRecord::Base.establish_connection(config.default)
  #ActiveRecord::Base.establish_connection({
  #  :adapter => 'mysql2',
  #  :host => 'localhost',
  #  :username => 'dbuser',
  #  :password => '',
  #  :database => 'your_database',
  #})
end

.load_tasksObject



35
36
37
38
39
# File 'lib/rawgento_models.rb', line 35

def self.load_tasks
  #load 'active_record/railties/databases.rake'
  ActiveRecordMigrations.load_tasks
  #load "rawgento_models.rake"
end