Class: Bookfile::BeerDef

Inherits:
Database show all
Defined in:
lib/bookfile/database/database.rb

Overview

change to BeerDatabase or DatabaseBeer - why, why not???

Instance Method Summary collapse

Methods inherited from Database

#connect, #setup

Constructor Details

#initialize(db_config) ⇒ BeerDef

check - if it works by default (no initialze specfied)



57
58
59
# File 'lib/bookfile/database/database.rb', line 57

def initialize( db_config )  ## check - if it works by default (no initialze specfied)

  super
end

Instance Method Details

#prepareObject

change to require - why, why not??



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/bookfile/database/database.rb', line 61

def prepare   ## change to require - why, why not??

  puts "setup beer: #{@db_config.inspect}"

  res = require 'beerdb/models'

  ## also add to xxxx ???

  ## (possible to include as globals ???? how - Object.send :include ???) or

  ##   Module.send :include ??


  if res == false
    ## find a better check - check for constants defined??? if not define???

    ##  or use constant_missing handler???

    puts "  todo/fix: BeerDb::Models already included ??"
  end

  ## for now always include

  puts "  include BeerDb::Models"

  ### check/fix: include as globals/top-level!!! how? possible???

  Builder.send      :include, BeerDb::Models
  PageCtx.send      :include, BeerDb::Models
  HybookHelper.send :include, BeerDb::Models ## constants not accesible (include in module too)



end