New to this, so bear with me. Controller: def show @client = Client.find_by_permalink(params[:permalink]) @images = ClientImage.find_all_by_client_id(@client, :order => "id ASC") session[:client] = @client if session[:image].blank? session[:image] = @images[0] end end def view_image @image = ClientImage.find_by_id(params[:id]) session[:image] = @image end View: <div id="content_top"> <%= image_tag url_for_file_column(session[:image], "image"), :alt => @client.name %> </div> RJS: page[:content_top].reload I thought that reloading the div after changing the session variable out would cause a new image to display, but it does nothing. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What button/link are you hitting that you want to reload the page with? What is the name of the function? What is the name of the view? What is the name of the controller? What is the name of the RJS file? Are you passing in info from the app to reload it? On 5/18/07, Aaron Wally <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > New to this, so bear with me. > > Controller: > > def show > @client = Client.find_by_permalink(params[:permalink]) > @images = ClientImage.find_all_by_client_id(@client, :order => "id > ASC") > session[:client] = @client > if session[:image].blank? > session[:image] = @images[0] > end > end > > def view_image > @image = ClientImage.find_by_id(params[:id]) > session[:image] = @image > end > > View: > > <div id="content_top"> > > <%= image_tag url_for_file_column(session[:image], "image"), :alt => > @client.name %> > > </div> > > RJS: > > page[:content_top].reload > > > > I thought that reloading the div after changing the session variable out > would cause a new image to display, but it does nothing. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Amos King Ramped Media USPS Programmer/Analyst St. Louis, MO Looking for something to do? Visit ImThere.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> What button/link are you hitting that you want to reload the page with?This creates a list of all the images in the client_images table associated with that client. It appears just below "content_top". <ul id="client_image_list"> <% if @images.length > 1 %> <% @images.each_with_index do |image, index| %> <%= link_to_remote index + 1, { :url => { :action => ''view_image'', :id => image } }, { :href => url_for(:action => ''view_image'', :id => image ) } %> <% end %> <% end %> </ul>> What is the name of the function? What is the name of the > view? What is the name of the controller? What is the name of the > RJS file?Everything is under the Client controller. This all takes place under the ''show'' view and action, ''view_image'' is the action to cycle out images and is also the name of the RJS.> Are you passing in info from the app to reload it?Yes. The value of the image to be changed is passed to the session[:image] variable. The idea is that by default the image shown is the oldest one associated with that client. @image is stored in a session variable (session[:image]) and called in the image_tag at the top. If a link in the ul is clicked, the ID of the image is passed to the ''view_image'' action. The view_image action assigns this new image to the session[:image] variable and the RJS reloads the div ''content_top''. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---