News for hackers. Stuff that matters.
Re:The Billy Baldwin of Conditional Assignment in Ruby by ned on Tuesday June 21, 2011 @03:30PM (#2680056)
Interesting.

For the example cited, you could also use ActiveRecord::Dirty

  def clean_summary
    self.summary = summary.squish if self.summary_changed?
  end
Re:The Billy Baldwin of Conditional Assignment in Ruby by laserlemon on Tuesday June 21, 2011 @03:34PM (#2680069)
Not quite because the summary could change to nil, but it brings up a good point. There's often a better way in Rails, but &&= is native Ruby so it's especially useful in non-Rails applications.