記事投稿アプリで公開日が過去の日付なら「公開」、未来の日付なら「公開待ち」と状態を変えるのにつまづいたので忘備録として残しておきます。 前提として記事の状態stateはenumで定義されています。 # draft: 下書き, published: 公開, publish_wait: 公開待ち enum state: { draft: 0, published: 1, publish_wait: 2 } article_controller.rbのupdateアクションがこのようになっています。 before_action :set_article, only: %i[edit update d…