2011-09-09 2 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' 

내가 코드 또는 레일에 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

이 코드는 모든 오류를 제거합니다. 그러나 이제는 마이그레이션이 잘 실행되지만 롤백은 수행되지 않습니다.

# Could not dump table "teams" because of following StandardError 
# Unknown type '' for column 'ROW' 
+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 

는 다음과 같은 오류를 보여줍니다. 마이그레이션 롤백 만 남아 있습니다. –