Skip to content

Instantly share code, notes, and snippets.

@leadhkr
Created March 9, 2015 02:50
Show Gist options
  • Save leadhkr/5c25d6a951233b48a71b to your computer and use it in GitHub Desktop.
Save leadhkr/5c25d6a951233b48a71b to your computer and use it in GitHub Desktop.
class Group
include DataMapper::Resource
property :id, Serial
property :group_name, String, { :required => true,
:unique => true,
:messages => { :is_unique => "League name is taken. Please choose another." }
}
property :password, BCryptHash, :required => true
validates_confirmation_of :password
attr_accessor :password_confirmation
validates_length_of :password_confirmation, :min => 6, if: :new_group
def new_group
self.new? || self.dirty?
end
has n, :users
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment