Skip to content

Instantly share code, notes, and snippets.

@VirtuosiMedia
Created March 1, 2012 20:11
Show Gist options
  • Save VirtuosiMedia/1952798 to your computer and use it in GitHub Desktop.
Save VirtuosiMedia/1952798 to your computer and use it in GitHub Desktop.
def update
@admin = Admin::Admin.find(params[:id])
respond_to do |format|
if params[:admin_admin][:change_password]
#call update_password here
else
if @admin.update_attributes(params[:admin_admin])
flash[:success] = "'#{@admin.name}' was successfully updated."
format.html { redirect_to admin_admins_path }
else
format.html { render action: "edit" }
end
end
end
end
def update_password
@admin = Admin::Admin.find(params[:id])
respond_to do |format|
if @admin.update_attributes(params[:admin_admin])
flash[:success] = "'Password was successfully changed."
format.html { redirect_to admin_admins_path }
else
format.html { render action: "change_password" }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment