2013-12-17 2 views
0

hstore을 검색하려고했지만 아무런 이음새도 검색하지 못했습니다.hStore와의 작업

나는 Player.last 내가

Player.last 
#<Player:0x007fa281c04bc8> { 
         :id => 4239, 
       :first_name => "Deborah", 
       :last_name => "Rutherford", 
        :nickname => "Eulah", 
      :played_positions => { 
           "position" => "OL" 
           } 
{ 

갔지만 않는 hstore 이름 played_positions

players라는 모델이 지금은 OL 위치를 준 모든 선수를 점점 데 문제가

은 마이 그 레이션 파일에 있습니다.

그리고 내 모델에서 나는 모든 도움을

store :played_positions 

감사가이

답변

2

이렇게하면 위치에 모든 선수를 줄 것이다 OL

Player.where("played_positions -> 'position' = 'OL'")