Skip to content

Instantly share code, notes, and snippets.

@radar
Forked from anonymous/gist:727693
Created December 3, 2010 23:08
Show Gist options
  • Select an option

  • Save radar/727695 to your computer and use it in GitHub Desktop.

Select an option

Save radar/727695 to your computer and use it in GitHub Desktop.
class YourModel < ActiveRecord::Base
before_create :set_downcase_subdomain
validates_uniqueness_of :subdomain
# other validations, associations and other methods go here
private
def set_downcase_subdomain
self.subdomain.downcase!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment