This repository was archived by the owner on Nov 22, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ def index
11
11
# GET /users/1
12
12
# GET /users/1.json
13
13
def show
14
- @user = User . find ( params [ :id ] )
15
-
16
- render json : @user , only : [ :id , :token ]
14
+ @user = User . find_by_token ( params [ :id ] ) || User . find ( params [ :id ] )
15
+
16
+ render json : @user
17
+ # render json: @user, only: [:id, :token]
17
18
# render json: User.find(params[:id]), only: [:id]
18
19
# render json: @user.id
19
20
end
@@ -57,6 +58,12 @@ def issues
57
58
head :ok
58
59
end
59
60
61
+ # def token
62
+ # @user = User.find_by_token(params[:id])
63
+
64
+ # render json: @user
65
+ # end
66
+
60
67
# DELETE /users/1
61
68
# DELETE /users/1.json
62
69
# def destroy
Original file line number Diff line number Diff line change 6
6
get 'users/:id/candidates' => 'users#candidates'
7
7
get 'users/:id/elections' => 'users#elections'
8
8
get 'users/:id/issues' => 'users#issues'
9
+
9
10
resources :candidates , only : [ :show ] , :constraints => { :format => /(json)/ }
10
11
resources :elections , only : [ :show ] , :constraints => { :format => /(json)/ }
11
12
resources :issues , only : [ :show ] , :constraints => { :format => /(json)/ }
12
13
resources :users , except : [ :destroy ] , :constraints => { :format => /(json)/ }
14
+
13
15
end
14
16
15
17
# resources :categories, :only => [:show], :constraints => {:format => /(json|xml)/}
You can’t perform that action at this time.
0 commit comments