Module: Mack::Genosaurus::Orm::Helpers

Defined in:
lib/mack-orm/genosaurus_helpers.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#columns(name = param(:name)) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mack-orm/genosaurus_helpers.rb', line 6

def columns(name = param(:name))
  ivar_cache("form_columns") do
    cs = []
    cols = (param(:cols) || param(:columns))
    if cols
      cols.split(",").each do |x|
        cs << Mack::Genosaurus::Orm::ModelColumn.new(name, x)
      end
    end
    cs
  end
end

#db_directoryObject



19
20
21
# File 'lib/mack-orm/genosaurus_helpers.rb', line 19

def db_directory
  Mack::Paths.db
end

#migrations_directoryObject



23
24
25
# File 'lib/mack-orm/genosaurus_helpers.rb', line 23

def migrations_directory
  File.join(db_directory, "migrations")
end

#next_migration_numberObject



27
28
29
30
31
32
33
# File 'lib/mack-orm/genosaurus_helpers.rb', line 27

def next_migration_number
  last = Dir.glob(File.join(migrations_directory, "*.rb")).last
  if last
    return File.basename(last).match(/^\d+/).to_s.succ
  end
  return "001"
end