2016-12-23 7 views

답변

0

을 무시 곳이 포함되도록 내가 하나에이 두 가지를 할 수 has_many의 realtionship

@places = User.find(4).places 

@places = @places.where(dog: false) if params[:no_dogs] 

을 갖는 두 개의 노드입니다 find() 메서드는 0 개의 인수를 사용합니다. 아마 이걸 원할거야?

@places = User.places # Calling the association gives an unexecuted proxy to a query to build 

@places = @places.where(dog: false) if params[:no_dogs] 

또는 당신이 User 모델로 작업하기를 원한다면 : 다음

@users = User.all 

@users = @users.where(dog: false) if params[:no_dogs] 
+0

나는 방법과 같은 큐에 내가 언급도 언급 어디 조건 사용할 필요가 가정 할 수있다 –