Flowdock
migrations() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/migration.rb, line 436
    def migrations
      @migrations ||= begin
        files = Dir["#{@migrations_path}/[0-9]*_*.rb"]
        
        migrations = files.inject([]) do |klasses, file|
          version, name = file.scan(/([0-9]+)_([_a-z0-9]*).rb/).first
          
          raise IllegalMigrationNameError.new(file) unless version
          version = version.to_i
          
          if klasses.detect { |m| m.version == version }
            raise DuplicateMigrationVersionError.new(version) 
          end

          if klasses.detect { |m| m.name == name.camelize }
            raise DuplicateMigrationNameError.new(name.camelize) 
          end
          
          load(file)
          
          klasses << returning(name.camelize.constantize) do |klass|
            class << klass; attr_accessor :version end
            klass.version = version
          end
        end
        
        migrations = migrations.sort_by(&:version)
        down? ? migrations.reverse : migrations
      end
    end
Register or log in to add new notes.