マイクロポストを気に入ったユーザーを表示するページを表示しようとしています。Uri を localhost:3000/microposts/someid#/into_it にしたいです。パスを介してコントローラに応答していないようですか?
view/microposts/_micropost.html.erb ファイルでこのページにリンクします。
<%= link_to micropost.votes_for, into_it_micropost_path(@micropost) %>
このパスが原因で、ブラウザーに次のエラーが表示され、ページが読み込まれません。
No route matches {:action=>"into_it", :controller=>"microposts", :id=>nil}
私のマイクロポストコントローラーで:
def into_it #for the view; displays who likes the post
@title = "Into_it!"
@micropost = Micropost.find(params[:id])
render 'show_users_into_it'
end
micropost/show_users_into_it は現在空のファイルです
ルート ファイル:
resources :microposts, only: [:create, :destroy, :into_it] do
member do
get :into_it
end
end
私が持っているレーキルートでは:
into_it_micropost GET /microposts/:id/into_it(.:format) microposts#into_it