Skip to content

Commit

Permalink
change Subdomain controller to accomodate shallow routes when a subdo…
Browse files Browse the repository at this point in the history
…main is destroyed
  • Loading branch information
fortuity committed Mar 18, 2010
1 parent a53ab54 commit baf988d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/subdomains_controller.rb
Expand Up @@ -23,7 +23,12 @@ def collection
end

def find_user
@user = User.find(params[:user_id])
if params[:user_id]
@user = User.find(params[:user_id])
else
@subdomain = Subdomain.find(params[:id])
@user = @subdomain.user
end
unless current_user == @user
flash[:alert] = "Are you logged in properly? You are not allowed to create or change someone else's subdomain."
redirect_to user_path(@user)
Expand Down

0 comments on commit baf988d

Please sign in to comment.