###前提・実現したいこと
パーシャルのパーシャルにコントローラーのインスタンス変数を送りたいです。
###発生している問題・エラーメッセージ
投稿のタイムラインをクリックすると、
Twitterのようなモーダルウィンドウが表示されるようにviewを作成しました。
モーダルウィンドウに表示されるview(コメントが追加されます) ≒ クリックした投稿です。
モーダルウィンドウには、内容などmicropostに関する情データが一切表示されなくなってしまいます。。。
【microposts/_micropost.html.erb】
【パーシャルの流れ】
index.html.erb → _user_index.html.erb → _micropost.html.erb → _modal.html.html.erb
※_micropost.html.erbまでは正常にデータが送られている。。。
と思います。
###該当のソースコード
【page#index】
@user = User.find_by(id: current_user.id) @microposts = current_user.feed.includes(:comments, :calls, :insists, :says) @micropost = current_user.microposts.build
【_user_index.html.erb】
<span class="index-microposts"><%= render partial: 'microposts/micropost', collection: @microposts, micropost: @micropost %></span>
【_micropost.html.erb】
<%= render 'microposts/modal', microposts: @microposts, micropost: @micropost %>
【_modal.html.erb】
<%= simple_format("#{markdown(micropost.content)}") %>
よろしければ、変数の送り方を教えてください。
そもそも、パーシャル多すぎなどのご指摘あればお願い致します。
マルチポスト
スタックオーバーフロー

あなたの回答
tips
プレビュー