Skip to content

Instantly share code, notes, and snippets.

@andrewpthorp
Created December 18, 2011 15:38
Show Gist options
  • Save andrewpthorp/1493726 to your computer and use it in GitHub Desktop.
Save andrewpthorp/1493726 to your computer and use it in GitHub Desktop.
class Message < ActiveRecord::Base
before_save :check_active_message
def check_active_message
if self.active
Message.where(:active => true).first.update_attributes(:active => false)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment