2017-12-04 7 views
1

내 Ruby 애플리케이션에 태양 흑점 Solr을 통합하려고합니다. 내 모델에서 추가 데이터를 인덱싱하기 위해 dynamic_string을 사용하고 있습니다. 그러나 나는 오류를에서동적 속성을 사용하는 흑점 인덱스

searchable do 
    text :name 
    integer :id 
    text :thumbnail_ref 
    integer :health_condition_id 
    dynamic_string :standard_codes, stored: true do 
     st_codes().inject({}) do |hash, e| 
     logger.info e.standard 
     logger.info e.standard_code 
     hash.merge(e.standard.to_sym => e.standard_code) 
     logger.info hash 
     end 
    end 

    end 

    def st_codes() 
    Standard.find_standards_by_health_condition(198) 
    end 

NoMethodError (정의되지 않은 메서드 merge' for true:TrueClass): app/models/content.rb:35:in 블록 (3 단계)는 무엇입니까 ' 응용 프로그램/모델/content.rb : 32 : 블록`(2 단계)에서'

I 여기에 대단히 감사합니다이 error.Any 도움말에 대한 명확하지 않다.

답변

0

당신이 다음 반복을 위해 주입 된 해시를 반환해야 주입 할 때. 기압이 logger.info에서 진정한 부울를 얻을.

변경된 내용

st_codes().inject({}) do |hash, e| 
    logger.info e.standard 
    logger.info e.standard_code 
    hash.merge!(e.standard.to_sym => e.standard_code) 
    logger.info hash 
    hash 
    end