こんにちは。
表題の件です。
【知りたいこと】
renderの引数とパーシャルの法則
【具体的な事例】
<%= render @feed_items %>
から、パーシャルが呼ばれています。
・パーシャルの場所と名前
app/views/microposts/_micropost.html.erb
・@feed_itemについて
homeアクション中に定義されています。
【static_pages_controller.rb】
def home @feed_item = current_user.feed.paginate(page: params[:page]) end
・feedについて
user.rbで定義されています。
def Micropost. where("user_id=?", id) end
railsチュートリアル・第11章・11・46より
(http://railstutorial.jp/chapters/user_microposts?version=4.2#sec-micropost_images)
この@feed_itemのなかにはMicropostのオブジェクトが入っているから、
_micropost.html.erbのパーシャルをよびだせているということでいいんでしょうか?
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。