Merge pull request #515 from ChrisBr/rooms

Refactoring admin room menu
This commit is contained in:
Christian Bruckmayer 2014-11-12 12:01:10 +01:00
commit 56747fc118
11 changed files with 135 additions and 52 deletions

View file

@ -6,13 +6,16 @@ class Room < ActiveRecord::Base
before_create :generate_guid
validates :name, presence: true
validates :size, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true
validates :size, presence: true, if: :public?
private
def generate_guid
guid = SecureRandom.urlsafe_base64
# begin
# guid = SecureRandom.urlsafe_base64
# end while Person.where(:guid => guid).exists?
self.guid = guid
end
end