verifying user exists before trying to update
This commit is contained in:
@@ -33,6 +33,7 @@ class UsersController < ApplicationController
|
||||
#user = User.find(:first, :conditions => ["user_id = ?", "#{params[:user][:user_id]}"])
|
||||
|
||||
user = User.find(:first, :conditions => "user_id = '#{params[:user][:user_id]}'")
|
||||
if user
|
||||
user.skip_user_id_assign = true
|
||||
user.skip_hash_password = true
|
||||
user.update_attributes(params[:user].reject { |k| %w(password password_confirmation user_id).include? k })
|
||||
@@ -45,6 +46,10 @@ class UsersController < ApplicationController
|
||||
format.html { redirect_to user_account_settings_path(:user_id => current_user.user_id) }
|
||||
format.json { render :json => {:msg => message ? "success" : "false "} }
|
||||
end
|
||||
else
|
||||
flash[:error] = "Could not update user!"
|
||||
redirect_to user_account_settings_path(:user_id => current_user.user_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user