Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created July 23, 2010 14:00
Show Gist options
  • Select an option

  • Save workmad3/487469 to your computer and use it in GitHub Desktop.

Select an option

Save workmad3/487469 to your computer and use it in GitHub Desktop.
class Objective < ActiveRecord::Base
before_save :check_state
ImmutableAttributesByState = { :open => [], :agreed => [:attrib1, :attrib2, :attrib3] }
def check_state
!ImmutableAttribuesByState[state].any? {|attribute| self.send(:"#{attribute}_changed?") }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment