From 92eabd3be7eff9cb014d1bcce5c11369447552b9 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 30 Dec 2014 19:47:51 +0800 Subject: [PATCH] some mods --- app/models/registered_site.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/registered_site.rb b/app/models/registered_site.rb index 5f2cd8e..a288a35 100644 --- a/app/models/registered_site.rb +++ b/app/models/registered_site.rb @@ -14,20 +14,21 @@ class RegisteredSite field :confirmation_token has_many :site_logs + has_many :installed_modules index({ confirmation_token: 1}, { unique: true }) + scope :active, ->{where(:access_granted => true,:site_confirmed => true)} def site_token self.uid end def generate_confirmation_token - self.confirmation_token = SecureRandom.hex(5) - self.save + self.confirmation_token = SecureRandom.hex(5) + self.save end def active? return self.access_granted && self.site_confirmed end - end \ No newline at end of file