Module: RareMap::ModelBuilder
- Included in:
- Mapper
- Defined in:
- lib/rare_map/model_builder.rb
Overview
RareMap::ModelBuilder converts an Array of DatabaseProfile into an Array of Model.
Instance Method Summary collapse
-
#build_models(db_profiles) ⇒ Array
Creaetes an Array of Model by given DatabaseProfile(s).
Instance Method Details
#build_models(db_profiles) ⇒ Array
Creaetes an Array of Model by given DatabaseProfile(s).
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rare_map/model_builder.rb', line 12 def build_models(db_profiles) models = [] db_profiles.each do |db_prof| db_prof.tables.each do |table| opts = db_prof. (table, opts) (table, opts) (table, opts) if opts.group? models << Model.new(db_prof.name, db_prof.connection, table, opts.group) else models << Model.new(db_prof.name, db_prof.connection, table) end end end build_relations models models end |