Skip to content

Instantly share code, notes, and snippets.

@dwaynemac
Created April 14, 2015 21:08
Show Gist options
  • Save dwaynemac/05bb65816c859aced584 to your computer and use it in GitHub Desktop.
Save dwaynemac/05bb65816c859aced584 to your computer and use it in GitHub Desktop.
before_save :set_key
def set_key
self.key = self.name.gsub('-','_').parameterize('_') if self.name.present?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment