<commit_before># Index action
get '/users' do
  logged_in?
  @users = User.all
  erb :'users/index'
end

# New action
get '/users/new' do
  erb :'users/new'
end

# Create action
post '/users' do
  @user = User.new(params[:user])

  if @user.save
    redirect '/users'
  else
    redirect '/users/new?error=Oops!%20The%20user%20was%20not%20created.'
  end
end

# Show action
get '/users/:id' do
  logged_in?
  @user = User.find(params[:id])

  relation = Following.find_by(user_id: 2, follower_id:1)
  puts ">>>>>>>>>>>#{relation} ....."
  erb :'users/show'
end

# Edit action
get '/users/:id/edit' do
  logged_in?
  @user = User.find(params[:id])
  erb :'users/edit'
end

# Update action
put '/users/:id' do
  logged_in?
  @user = User.find(params[:id])

  @user.assign_attributes(params[:user])

  if @user.save
    redirect '/users'
  else
    erb :'users/edit?errors=User%20was%20not%20updated.'
  end
end

#User follow another user
get '/users/:id/follow/:to_follow_id' do
  Following.create(follower_id: params[:id], user_id: params[:to_follow_id])<commit_msg>to pull<commit_after># Index action
get '/users' do
  logged_in?
  @users = User.all
  erb :'users/index'
end

# New action
get '/users/new' do
  erb :'users/new'
end

# Create action
post '/users' do
  @user = User.new(params[:user])

  if @user.save
    redirect '/users'
  else
    redirect '/users/new?error=Oops!%20The%20user%20was%20not%20created.'
  end
end

# Show action
get '/users/:id' do
  logged_in?
  @user = User.find(params[:id])

  relation = Following.find_by(user_id: params[:id], follower_id: @current_user.id)
  puts ">>>>>>>>>>>#{relation} ....."
  erb :'users/show'
end

# Edit action
get '/users/:id/edit' do
  logged_in?
  @user = User.find(params[:id])
  erb :'users/edit'
end

# Update action
put '/users/:id' do
  logged_in?
  @user = User.find(params[:id])

  @user.assign_attributes(params[:user])

  if @user.save
    redirect '/users'
  else
    erb :'users/edit?errors=User%20was%20not%20updated.'
  end
end

#User follow another user
get '/users/:id/follow/:to_follow_id' do
  Following.create(follower_id: params[:id], user_id: params[:to_follow_id])
{'fraction_non_alphanumeric': 0.16883720930232557, 'fraction_numerical': 0.01581395348837209, 'mean_word_length': 3.910958904109589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '505173', 'n_tokens_mistral': 856, 'n_tokens_neox': 840, 'n_words': 187}