2018-11-05から1日間の記事一覧
パーシャルにオブジェクトの複数形を渡し、見やすいコードにする 基本の使い方 collectionオプションにより、コレクションのメンバごとにパーシャルをレンダリングする <%= render partial: "product", collection: @products %> 具体的な使い方 Before Refa…
ある値がnilかどうかでif文を分岐させる場合、引数で || 記法が使えないかを検討する if文で分岐させる書き方 def redirect_back_to(default) if session[:forwarding_url].nil? redirect_to default else redirect_to session[:forwarding_url] session.del…