summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
Diffstat (limited to 'users/app')
-rw-r--r--users/app/controllers/users_base_controller.rb2
-rw-r--r--users/app/models/token.rb6
-rw-r--r--users/app/models/user.rb8
3 files changed, 2 insertions, 14 deletions
diff --git a/users/app/controllers/users_base_controller.rb b/users/app/controllers/users_base_controller.rb
index dc2fa16..9becf0d 100644
--- a/users/app/controllers/users_base_controller.rb
+++ b/users/app/controllers/users_base_controller.rb
@@ -7,7 +7,7 @@ class UsersBaseController < ApplicationController
protected
def fetch_user
- @user = User.find_by_param(params[:user_id] || params[:id])
+ @user = User.find(params[:user_id] || params[:id])
if !@user && admin?
redirect_to users_url, :alert => t(:no_such_thing, :thing => 'user')
elsif !admin? && @user != current_user
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,