followers_controller.rb
712 Bytes
class FollowersController < MyProfileController
def index
@followed_people = current_person.following_profiles.paginate(:per_page => 5, :page => params[:npage])
end
def set_category
if request.method == "GET"
render :partial => "set_category_modal", :locals => { :followed_profile_id => params[:followed_profile_id] }
elsif request.method == "POST"
params[:followed_profile_id] ||= profile.id
follower = ProfileFollower.find_by(follower_id: current_person.id, profile_id: params[:followed_profile_id])
follower.update_attributes(:group => params[:category_name]) if follower
redirect_to url_for(:controller => "followers", :action => "index")
end
end
end