Browse code

Pridany relationship tokenu a usera

Cinan Rakosnik authored on 23/03/2013 at 10:29:33
Showing 1 changed files
... ...
@@ -5,6 +5,7 @@ class Token
5 5
 	include Mongoid::Timestamps::Created
6 6
 
7 7
 	index({ token: 1 })
8
+    belongs_to :user
8 9
 
9 10
 	field :token, type: String
10 11
 	field :date_expiring, type: DateTime
... ...
@@ -41,7 +42,11 @@ class Token
41 41
 	#	self.delete_all(token: token)
42 42
 	#end
43 43
 
44
-	private
44
+    def self.fing_user_accounts_having_to_token(token)
45
+        where(token: token).first().user.jids
46
+    end
47
+
48
+    private
45 49
 
46 50
 	def self.generate_token
47 51
 		begin