Rails 3からActiveModelが追加されたが、これはどーいうものかというと、 ActiveRecordはテーブルのデータを操作するのに対して ActiveModelはテーブルの存在しないデータを操作するために使用する。 と思う。 ActiveModelの肝は大きくみて4つくらいあるらしい。 アトリビュート コールバック 変更記憶 バリデーション ほかにもいくつか楽しそうな物はあるが、とりあえず、この4つについてREADMEから情報を拾ってみたいと思います。 アトリビュートは、モデル内に項目を作る class Person include ActiveModel::AttributeMethods attribute_method_prefix 'clear_' define_attribute_methods [:name, :age] attr_accessor :name,
![ActiveModel | GENDOSU@NET](https://cdn-ak-scissors.b.st-hatena.com/image/square/31cf84cda6a253c0e1b3496f0e315bcafe8223ae/height=288;version=1;width=512/https%3A%2F%2Fgendosu.jp%2Fwp-content%2Fuploads%2F2016%2F03%2Fgendosu-logo-img.png)