2013-04-28 4 views
2

를 사용하는 동안 나는 내 컨트롤러에서이 코드를 가지고 :레일 파인더 옵션으로 처음 4 관계 번호가 사용되지 않습니다 - #where

다음 중단 경고 결과
def index 
    @purchases = Purchase.all 
    @purchases = @purchases.where(user_id: current_user.id) unless current_user.admin 
    @purchases = @purchases.paginate(per_page: 30, page: params[:page]) 
end 

:

DEPRECATION WARNING: Relation#first with finder options is deprecated. Please build a scope and then call #first on it instead. 

I 돈 #ifirst를 사용하지 않기 때문에 이유를 이해하지 못합니다. 나는 또한 문제가 확실히 #index 액션 내부의 두 번째 라인에 있음을 지적해야한다. 주석으로 처리하면 더 이상 사용되지 않는다.

답변

4

이것은 궁리했습니다. 분명히 방법 #current_user은 더 이상 사용되지 않는 AR 쿼리를 사용하고있었습니다. 'rails4'브랜치를 사용하십시오.