# You currently have:
<%= link_to_remote "Switch resolution",
:url => {:action => 'toggle_resolution'} %>
# Instead, include the id as well so you can look up the video to be refreshed
<%= link_to_remote "Switch resolution",
:url => {:action => 'toggle_resolution', :id = @video.id} %>
# Update your toggle_resolution action as so:
# do a find() for the @video and don't bother passing it as a
# local because partials can see instance variables
def toggle_resolution
@video = Video.find(params[:id])
session[:hi_res] = !session[:hi_res] # toggle true/false
@res_val = session[:hi_res]
render :update do |page|
page.replace_html 'video_display', :partial => 'video_display'
end
end
|