ユーザーに属する要素だけを返したい。値は実行からのuser_id
列です。私が欲しいのは、runs
からのものだけを選択することcurrent_user
です。
def index
@runs = Run.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @runs }
end
end
のようなものを試したように
@runs = Run.where(user_id= => current_user.id)
しかし、それはうまくいきませんでした。どうすればいいですか?