2020-12-06から1日間の記事一覧
下記のようなRailsの記述。 @tweet = Tweet.find(params[:id]) が何度も出ていてなんとも Dry じゃない。 before_actionを使ってまとめられるのでまとめていく。 class TweetController < ApplicationController def show @tweet = Tweet.find(params[:id]) …
下記のようなRailsの記述。 @tweet = Tweet.find(params[:id]) が何度も出ていてなんとも Dry じゃない。 before_actionを使ってまとめられるのでまとめていく。 class TweetController < ApplicationController def show @tweet = Tweet.find(params[:id]) …