Skip to content

Commit

Permalink
Merge pull request #20 from cbus-sea-lions-2015/update-user
Browse files Browse the repository at this point in the history
add users#update route
  • Loading branch information
mdmartinez committed Apr 21, 2015
2 parents 754d089 + 6d22c56 commit 5aecb63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ def create
end

def show
render json: @user.to_json
user = User.find(auth0_id: params[:auth0_id])
render json: user.to_json
end

def update
user = User.find_by(auth0_id: params[:auth0_id])
user.update(params)
render json: user.to_json
end

end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Rails.application.routes.draw do
resources :libraries, only: [:show, :new, :create, :index]
resources :users, only: [:index, :new, :create]
resources :users, only: [:index, :new, :create, :update]
resources :categories, only: [:index]
resources :mechanics, only: [:index]
resource :sessions, only: [:new, :create, :destroy]
Expand Down

0 comments on commit 5aecb63

Please sign in to comment.