概要 原著者の許諾を得て翻訳・公開いたします。 英語記事: Automatically cast params with the Rails Attributes API | Boring Rails: Skip the bullshit and ship fast 原文公開日: 2021-02-15 著者: Matt Swanson サイト: Boring Rails 日本語タイトルは内容に即したものにしました。 Railsアプリでは、ロジックを抽出してPORO(Plain-Old Ruby Object)にすることがよく行われます。しかしコントローラでparamsから直接これらのオブジェクトにデータを渡していることも多く、その場合はデータが文字列になってしまいます。 class SalesReport attr_accessor :start_date, :end_date, :min