I''m trying to embed a little image gallery on each page. The photos need to be different for each page. I just want to use ajax and let them click on the photo and have it show the next image. When the page loads, it shows the correct image. But when clicking on it, it gives an error because it doesn''t know what @images is anymore. On the view for the home page: <div id="easel"><%= render_component(:controller => ''tiny_gallery/album'', :action => ''show_photo'', :params =>{:context=> :home }) %></div> Component Controller: class TinyGallery::AlbumController < ActionController::Base uses_component_template_root def show_photo case when params[:context] == :home @images = [''/images/1.jpg'', ''/images/2.jpg''] else @images = [''/images/test.gif''] end end end Component View: <% # p is always 0 when it comes in the first time... photo = (params[:p]).to_i next_photo = photo + 1 if !(photo == @images.length-1) %> <%= link_to_remote(image_tag(@images[next_photo], :size => "285x169"), :update =>''easel'', :url => { :controller => ''/tiny_gallery/album'', :action => ''show_photo'', :params => { :context => :home, :p => next_photo }}) %> <% else %> <%= link_to_remote(image_tag(@images[0], :size => "285x169"), :update =>''easel'', :url => { :action => ''show_photo'', :params => { :context => :home, :p => 0 }}) %> <% end %> When I change the component controller to not use the case statement, it works just fine, but doesn''t give me the option of showing different photos based on which page it''s being generated on...