コード日進月歩

しんくうの技術的な小話、メモ、つれづれ、など

2019-06-07から1日間の記事一覧

ActiveModel::Attributesはプレーンな値を持つだけのオブジェクトを作るときに値をよしなに処理してくれるので便利

型が欲しい!!!とか思ったときそっと添えることのできる機能として 環境 $ bin/rails -v Rails 5.2.2 例 class NoRecordUser include ActiveModel::Model include ActiveModel::Attributes attribute :name, :string attribute :age, :integer attribute :…