diff options
author | Azul <azul@leap.se> | 2013-08-28 11:53:58 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-08-30 14:54:30 +0200 |
commit | 7bb1a16d4eee3eb3ef36c6f5b4fc7968e3da7dd6 (patch) | |
tree | 75df9def4e9289b5373cea6108616405896491e1 /users/app/models | |
parent | 060e06daa065f02b811dfe12850b101a62c12c8d (diff) |
there's no need for User#find_by_param. clean it up
Diffstat (limited to 'users/app/models')
-rw-r--r-- | users/app/models/token.rb | 6 | ||||
-rw-r--r-- | users/app/models/user.rb | 8 |
2 files changed, 1 insertions, 13 deletions
diff --git a/users/app/models/token.rb b/users/app/models/token.rb index 514b97f..3de0059 100644 --- a/users/app/models/token.rb +++ b/users/app/models/token.rb @@ -2,14 +2,10 @@ class Token < CouchRest::Model::Base use_database :tokens - property :user_id, String, accessible: false + belongs_to :user validates :user_id, presence: true - def user - User.find(self.user_id) - end - def initialize(*args) super self.id = SecureRandom.urlsafe_base64(32).gsub(/^_*/, '') diff --git a/users/app/models/user.rb b/users/app/models/user.rb index c1988f3..8874966 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -34,14 +34,6 @@ class User < CouchRest::Model::Base view :by_created_at end # end of design - class << self - alias_method :find_by_param, :find - end - - def to_param - self.id - end - def to_json(options={}) { :login => login, |