2011-09-09 3 views
1

HyperRecordのフロントエンドでHypertable dbを使用しています。私はそれに固定されたいくつかのバグがありました。しかし、今や移行は私を抱きしめてしまいます。これまでに移行すると、エラーが表示されます:レールによる問題の原因となる高性能な移行2.3.8

rake aborted! 
undefined method `select_rows' for #<ActiveRecord::ConnectionAdapters::HypertableAdapter:0xb6f791c4> 
.rvm/gems/[email protected]/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:27:in `select_values' 

私はコードまたはレール上のruby actice_recordを調べます。それが示している。

# Returns an array of arrays containing the field values. 
    # Order is the same as that returned by +columns+. 
    def select_rows(sql, name = nil) 
    end 
    undef_method :select_rows 

これらの機能は、初期化時に修正を加えて削除しようとしました。

module ActiveRecord 
    module ConnectionAdapters 
    class HypertableAdapter 

     def select_rows(sql, name = nil) 
     end 
    end 
    end 
end 

その後、エラーNil value occurred while accepting array or hashが発生しました。それを修正するために私は修正コードに新しいメソッドを追加しました。

module ActiveRecord 
    module ConnectionAdapters 
    class HypertableAdapter 

     def select_rows(sql, name = nil) 
     end 

     def select_values(sql, name = nil) 
     result = select_rows(sql, name) 
     result.map { |v| v[0] } unless result.nil? 
     end 
    end 
    end 
end 

は、それはエラーで来た:

rake aborted! 
You have a nil object when you didn't expect it! 
You might have expected an instance of Array. 
The error occurred while evaluating nil.map 
/.rvm/gems/[email protected]/gems/activerecord-2.3.8/lib/active_record/migration.rb:421:in `get_all_versions' 

は、いずれかはそれで何が起こっているか、アイデアを持っていますか?

答えて

0

このコードは、すべてのエラーを削除します。しかし、今は移行はうまくいくが、ロールバックはしない。

module ActiveRecord 
    module ConnectionAdapters 
    class HypertableAdapter 

     def select_rows(sql, name = nil) 
     result = execute(sql) 
     rows = [] 
     result.cells.each { |row| rows << row } 
     rows 
     end 

     def select_values(sql, name = nil) 
     result = select_rows(sql, name) 
     result.map { |v| v[0] } unless result.nil? 
     end 
    end 
    end 
end 

私はスキーマファイルにチェックインすると、それは次のようなエラーが表示されます。

# Could not dump table "teams" because of following StandardError 
# Unknown type '' for column 'ROW' 
+0

この修正プログラムは、移行アップとアクティブレコードモデルのために完璧に動作します。移行ロールバックのみが残っています。 –

関連する問題