I know, the current already asked, but I can not fix it...
Gemfile
gem 'rails', '3.2.9'
gem 'jquery-rails' , '2.0.2'
class RelationshipsController < ApplicationController
def create
@user = User.find(params[:relationship][:followed_id])
current_user.follow!(@user)
respond_to do |format|
format.html { redirect_to @user }
format.js
end
end
create.js.erb
$("#follow_form").html("<%= escape_javascript(render('shared/unfollow')) %>")
I have partial \app\views\shared\_unfollow.html.erb
<%= form_for current_user.relationships.find_by_followed_id(@account),
:html => { :method => :delete }, :remote => true do |f|%>
<div class="actions"><%= f.submit 'unfollow' %></div>
<% end %>
if press the button, the state does not change. Try add ".html_safe" doesn't work too.
But if I do
$("#follow_form").html("bla bla bla")
or
$("#follow_form").html("<%= 10+10 %>")
it's work