Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:14:08+00:00 2026-06-15T20:14:08+00:00

Since I enabled remote true, it should change the toggle button Follow to Un-Follow

  • 0

Since I enabled remote true, it should change the toggle button “Follow” to “Un-Follow” right away.
But it doesn’t. If I reload the page, toggle button shows changed label.
So it means that it’s actually changing the value of follow column in background.
I’ve already spent 3 days for this but I still have no idea:(
Can anyone help me how to solve this? Is there anything wrong with codes? or am I missing some file for JQuery?
I’m so newbie to Rails…

Gemfile

...
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
  gem 'jquery-ui-rails'

end

gem 'jquery-rails'

…

assets/javascripts/application.js

...
//= require twitter/bootstrap
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require_tree 
...

views/shared/_follow_user.html.erb

<% unless user == current_user %>
  <% if current_user.following?(user) %>
    <%= link_to sanitize('<i class="icon-remove icon-white"></i> ') + 'Un-Follow', user_follow_path(user.to_param, current_user.get_follow(user).id), :method => :delete, :remote => true, :class => 'btn' %>             
  <% else %>
    <%= link_to sanitize('<i class="icon-ok icon-white"></i> ') + 'Follow', user_follows_path(user.to_param), :remote => true, :class => 'btn btn-primary' %>             
  <% end %>
<% end %>

views/users/create.js.erb

$('#follow_user').html('<%= escape_javascript(render :partial => "shared/follow_user", :locals => {:user => @user}) %>');

views/users/destroy.js.erb

$('#follow_user').html('<%= escape_javascript(render :partial => "shared/follow_user", :locals => {:user => @user}) %>');

controllers/follows_controller.rb

class FollowsController < ApplicationController

  def create
    @user = User.find(params[:user_id])
    current_user.follow(@user)
  end

  def destroy
    @user = User.find(params[:user_id])
    current_user.stop_following(@user)
  end

end

config/routes.rb

...
resources :users, :only => [:index, :show] do
  resources :follows, :only => [:create, :destroy]
end
...

models/user.rb

class User < ActiveRecord::Base

  ...

  acts_as_follower
  acts_as_followable

  ...  

end

views/users/show.html.erb

<h1>Users#show</h1>

<p id="notice"><%= notice %></p>

<p>
  <b>User:</b>
  <%= @user.user_profile.user_id %>
</p>

<p>
  <b>Language:</b>
  <%= @user.user_profile.language_id %>
</p>

<p>
  <b>Country:</b>
  <%= @user.user_profile.country_id %>
</p>

<p>
  <b>Prefecture:</b>
  <%= @user.user_profile.prefecture_id %>
</p>

<p>
  <b>Gender:</b>
  <%= @user.user_profile.gender_id %>
</p>

<p>
  <b>Nickname:</b>
  <%= @user.user_profile.nickname %>
</p>

<p>
  <b>Introduction:</b>
  <%= @user.user_profile.introduction %>
</p>

<p>
  <b>Picture url:</b>
  <%= @user.user_profile.picture_url %>
</p>

<% if user_signed_in? %>
  <div id="follow_user">
    <%= render :partial => "shared/follow_user", :locals => {:user => @user} %>
  </div>
<% end %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:14:10+00:00Added an answer on June 15, 2026 at 8:14 pm

    You forget the rendering into your Follows Controller.

    here the code for my test i used a bit of your code but i use RubyCas-Server as layer to authentification.

    So just check controller, views 🙂

    https://github.com/senayar/follower

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having this issue since offline_access has been deprecated and migration enabled. I'm getting
since memcpy should be highly optimized nowadays, does it still make sense to optimize
Since I am developing an iOS >= 5.0 application, I am trying to change
Since I have no errors I don't know if this is the right place
Since we moved from IIS 7.0 to IIS 7.5 the Windows Authentication doesn't work
since today i get an Exception on IIS7.5 with ASP.NET MVC, but i dont
How do you debug your SharePoint 2007 code? Since SharePoint runs on a remote
Since File API will enable access to the content of local files it is
Since regular jQuery animations are not fluent on iOS ( .hide() , slideDown() ),
since today im facing a strange problem. When i start my app in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.