# Make name on link\_to\_remote change

**URL:** <https://www.ruby-forum.com/t/make-name-on-link-to-remote-change/143417>\
**Category:** Rails\
**Created:** [July 18, 2008, 10:30am UTC](https://www.ruby-forum.com/t/make-name-on-link-to-remote-change/143417 "2008-07-18T10:30:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [July 18, 2008, 10:30am UTC](https://www.ruby-forum.com/t/make-name-on-link-to-remote-change/143417/1 "2008-07-18T10:30:40Z")

</div>

Hello,

I have the following link\_to\_remote code that calls the going method.  
It works right but I want that after the call the name “Not going!”  
changes to “I am going!”. Whats the easiest way to do this? I have a  
going.js.rjs file which is below.

- \<%= link\_to\_remote 'Not going!', :url =\> going\_neighborhood\_event\_path(@event.user.neighborhood,@event), :method =\> :put if current\_user == @event.user %\>

* * *

# js file

if @attendance.errors.empty?  
page.visual\_effect(:highlight, “going”, :duration =\> 1)  
end

* * *

def going  
@attendance = Attendance.find(:first, :conditions =\> [“event\_id = ?  
and user\_id = ?”, params[:id], current\_user.id])  
if @attendance.toggle!(:rsvp)  
respond\_to { |format| format.js }  
end  
end
