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.
<div id="going">
<li><%= link_to_remote ''Not going!'', :url =>
going_neighborhood_event_path(@event.user.neighborhood,@event), :method
=> :put if current_user == @event.user %></li>
</div>
---
# 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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---