Skip to content

Instantly share code, notes, and snippets.

@biagidp
Created December 21, 2011 18:10
Show Gist options
  • Save biagidp/1507033 to your computer and use it in GitHub Desktop.
Save biagidp/1507033 to your computer and use it in GitHub Desktop.
lib/save_as_draft for rails 3.0
class ActiveRecord::Base
module SaveAsDraft
def save
if self.has_attribute?(:record_status) and self.record_status == "Draft"
super(:validate => false)
else
super
end
end
end
include SaveAsDraft
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment