Sending dynamic variable from view to RJS file (AJAX)

How do I send a dynamic variable (album_id) too an ajax RJS file
copied below?

This works fine with a static span ID but Im not sure how to transfer
the album.id


VOTE2.rjs

page.replace_html ‘<%= @albums.id %>’, @albums.reload.votes_count
page[:vote_score].visual_effect :highlight


HTML (VIEW)

<%= @albums.votes_count %>
        <div id="vote_link">

        <% if logged_in? %>

<%= link_to_remote ‘Hype’,
{ :url => { :action => ‘vote2’, :id => @albums } },
{ :href => url_for(:action => ‘vote2’, :id => @albums) } %><% else %><
%= link_to ‘Hype’,
:controller => ‘account’, :action => ‘login’ %>
<% end %>


ALBUM CONTROLLER

def vote2
@albums = Albums.find(params[:id])
@albums.votes.create(:user => @current_user)
respond_to do |wants|
wants.html { redirect_to :action => ‘index’,
:permalink => @albums.permalink }
wants.js { render }
end

On 5/17/07, [email protected] [email protected] wrote:

page.replace_html ‘<%= @albums.id %>’, @albums.reload.votes_count

.rjs files are Ruby, so lose the erb:

page.replace_html @albums.id, @albums.reload.votes_count

Also, in HTML, ID’s are supposed to start with a letter
(Basic HTML data types), so I would do
something like this:

page.replace_html “albums_#{@albums.id}”, @albums.reload.votes_count

(and a similar construct in the view)