I have one page in view side of my application where there is a loop of the object @users now i want to update only one part of the div and that div is inside the loop i have made div dinamic but i want to update that div , in the same page. I have used partial page to update the page by controller , but that is not wrking due to div is in loop . my code is view side :
<% for user in @users %>
<% if !user.country.blank?%> <%= user.country.to_s.capitalize %><%end%>
<div id="div_state_<%=user.id%>">
<%= user.state %>
<%if user.state == 'active'%>
<%= link_to_remote image_tag("/images/de-active.png",:title =>" make it pending"), :url => admin_manage_user_state_change_path(user.id),:update => 'div_state_#{user.id}' %>
<%else%>
<%= link_to_remote image_tag("/images/active.png",:title =>" make it active"), :url => admin_manage_user_state_change_path(user.id),:update => 'div_state_#{user.id}' %>
<%end%>
</div>
controller side:
@user = User.find(params[:manage_user_id])
if @user.state=="active"
@user.state = "pending"
end
@user.save
render :update do |page|
page.visual_effect :highlight, "div_state_#{@user.id}", :duration=>3
end