Skip to content

Commit

Permalink
Changing API slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
wengzilla committed Jun 9, 2012
1 parent be7792d commit 804b991
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 5 additions & 6 deletions app/controllers/api/v1/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
class Api::V1::UsersController < ApplicationController
respond_to :json

def show
@user = User.where(id: params[:id].to_s).first
if @user
render :json => @user.to_json
if @user = User.where(id: params[:id].to_s).first
respond_with @user
else
render :json => {:error => "user not found"}.to_json, :status => 404
render :json => {:error => "User not found."}, :status => :not_found
end
end

end
end
4 changes: 0 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ def self.approved_email?(email)
domain = email.split('@').last
ACCEPTED_DOMAINS.include? domain
end

def to_json
super(:except => :password)
end
end

0 comments on commit 804b991

Please sign in to comment.