リア充爆発日記

You don't even know what ria-ju really is.

RailsのDirtyはなぜDirtyというのか。

教えてください。

http://api.rubyonrails.org/classes/ActiveModel/Dirty.html
ActiveRecordの状態をトラッキングできる便利なモジュール。

これを使うと、非公開から公開になったタイミングで公開日を入れる、的な処理がキレイに書ける。

  before_save :publish

  private

  def publish
    self.published_at = Time.now if self.status_changed? and self.status == Status::PUBLIC
    self.published_at = nil if self.status_changed? and self.status == Status::PRIVATE
  end

便利だわー

あと、三隅と熊野はほんとうに実在しているのかも教えて下さい。
[rakuten:digitamin:10118689:detail]