Topic: RJS partial scope and other controllers

I have a RJS template in which I want to call a partial that belongs to another controller.

I have a partial called _star.rhtml in views/projects/
My RJS is /views/hot/add.rjs

I call the hot/add method via a form_remote_tag in _star.rhtml and want it to update itself.  Here's the code:

_star.rhtml

<div id="star<%= @project.id %>">
<%
  if @project.in_hot_list?(session[:user_id])
    add_or_del = "del"
    imgsrc = "star_on.gif"
  else
    add_or_del = "add"
    imgsrc = "star_off.gif"
  end
%>
<%= form_remote_tag :url => { :controller => "hot", :action => add_or_del } %>
<%= hidden_field 'hot', 'project_id', :value => @project.id %>
<%= hidden_field 'hot', 'user_id', :value => session[:user_id] %>
<input type='image' src='<%= '/images/' + imgsrc %>' />
<%= end_form_tag %>
</div>

add method in hot controller:
def add
    @hot = Hot.new(params[:hot])
    @hot.save
    @project_id = params[:hot][:project_id]
  end

add.rjs
page.replace "star#{project_id}", :partial => 'star' #I don't know what to call here

If art interprets our dreams, the computer executes them in the guise of programs.

-SICP (Abelson, Sussman)

Re: RJS partial scope and other controllers

I think it should be

page.replace "star#{project_id}", :partial => 'projects/star'

(You might need an initial '/' as well

My RoR journey  -- thoughts on learning RoR and lessons learned in applying TDD and agile practices.