Skip to content

Commit

Permalink
Adjust profile controller to support limited profile viewing
Browse files Browse the repository at this point in the history
  • Loading branch information
rdegraci committed Dec 23, 2011
1 parent 9dfb229 commit e4df0a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def index
def show
begin
@profile = Profile.find(params[:id])
@profile = current_user.profile
@current_user = current_user
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @profile }
Expand All @@ -48,10 +48,11 @@ def new
# GET /profiles/1/edit
def edit
begin
@profile = Profile.find(params[:id])
@query_profile = Profile.find(params[:id])
@profile = current_user.profile
raise if @query_profile != @profile
rescue
redirec_to :root
redirect_to :root
end
end

Expand All @@ -77,7 +78,6 @@ def create
# PUT /profiles/1.json
def update
begin
@profile = Profile.find(params[:id])
@profile = current_user.profile
rescue
redirect_to :root
Expand All @@ -99,7 +99,6 @@ def update
# DELETE /profiles/1.json
def destroy
begin
@profile = Profile.find(params[:id])
@profile = current_user.profile
@profile.destroy
rescue
Expand Down

0 comments on commit e4df0a6

Please sign in to comment.