Skip to content

Instantly share code, notes, and snippets.

@ubermajestix
Created February 10, 2009 16:45
Show Gist options
  • Save ubermajestix/61454 to your computer and use it in GitHub Desktop.
Save ubermajestix/61454 to your computer and use it in GitHub Desktop.
# this is from my users_controller file
def reset_password
# reset user's password here...
respond_to do |format|
format.html { redirect_to(users_url) }
format.js do
render :update do |page|
# this is where I had a bunch of page. calls that I called in several methods
# they've all disapeared into the replace_user_row method
replace_user_row(page)
end
end
end
end
helper_method :replace_user_row
def replace_user_row(page)
page.replace_html dom_id(@user), :partial => "users/user_row", :locals=>{:user=>@user}
page.replace_html "manage_#{dom_id(@user)}", :partial => "user_actions", :locals=>{:user=>@user}
page.show "manage_#{dom_id @user}"
page.show "close_#{dom_id(@user)}"
page.hide "loading_#{dom_id(@user)}"
page.hide "open_#{dom_id(@user)}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment