Sha256: c351d5defa833405a7ef4d5a5500efa1a4c02083b1988119d611b9604d9ee224

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

module Mack
  module Genosaurus # :nodoc:
    module DataMapper # :nodoc:
      module Helpers # :nodoc:
      
        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::DataMapper::ModelColumn.new(name, x)
              end
            end
            cs
          end
        end

        def db_directory
          File.join(Mack.root, "db")
        end
      
        def migrations_directory
          File.join(db_directory, "migrations")
        end
      
        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
      
        ::Genosaurus.send(:include, self)
      
      end # Helpers
    end # DataMapper
  end # Genosaurus
end # Mack

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mack-data_mapper-0.6.1.1 lib/mack-data_mapper/genosaurus_helpers.rb
mack-data_mapper-0.6.1.2 lib/mack-data_mapper/genosaurus_helpers.rb
mack-data_mapper-0.6.1 lib/mack-data_mapper/genosaurus_helpers.rb