Sha256: ccf1ecf31b05785163fe75ffc4f0866f700326b9b433716555ec64d1372965df

Contents?: true

Size: 991 Bytes

Versions: 11

Compression:

Stored size: 991 Bytes

Contents

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

        def db_directory
          Mack::Paths.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 # Orm
  end # Genosaurus
end # Mack

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mack-orm-0.7.1 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.7.1.1 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.0 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.0.101 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.0.3 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.1 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.3 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.3.1 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.0.2 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.0.1 lib/mack-orm/genosaurus_helpers.rb
mack-orm-0.8.2 lib/mack-orm/genosaurus_helpers.rb