레일 -- 페이지 라우팅 컨트롤러 보기

메서드를 정의하고 새 페이지에서 사용자 컬렉션을 가져와서 경로에 추가합니다.

resource  :xxx do

  collection do 
    get :my_collections
  end
end

def my_collections                                          
  #@contracts = Contract.where('address = ?', current_user.address )
   @contracts = Contract.where('address = ?', params[:address] )
end

이후 단계에서 사용자의 주소나 전화번호를 얻기 위해 올바른 사용자를 결정하기 위해 사용자 로그인이 추가됩니다. params[:address]를 사용할 수도 있습니다.

Supongo que te gusta

Origin blog.csdn.net/Toml_/article/details/131591165
Recomendado
Clasificación