Commit 2aec1fc0 by Mai Hoang Thai Ha

bugs

parent af17d044
Pipeline #1267 failed in 0 seconds
......@@ -7,6 +7,8 @@ ruby '3.0.1'
gem 'rails', '~> 6.1.3', '>= 6.1.3.2'
gem 'bcrypt', '3.1.13'
gem 'faker', '2.1.2'
gem 'will_paginate', '3.1.8'
gem 'bootstrap-will_paginate'
gem 'bootstrap-sass', '3.4.1'
gem 'autoprefixer-rails'
# Use Puma as the app server
......
......@@ -72,6 +72,8 @@ GEM
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
bootstrap-will_paginate (1.0.0)
will_paginate
builder (3.2.4)
byebug (11.1.3)
capybara (3.35.3)
......@@ -238,6 +240,7 @@ GEM
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
will_paginate (3.1.8)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
......@@ -250,6 +253,7 @@ DEPENDENCIES
bcrypt (= 3.1.13)
bootsnap (>= 1.4.4)
bootstrap-sass (= 3.4.1)
bootstrap-will_paginate
byebug
capybara (>= 3.26)
faker (= 2.1.2)
......@@ -274,6 +278,7 @@ DEPENDENCIES
web-console (>= 4.1.0)
webdrivers
webpacker (~> 5.0)
will_paginate (= 3.1.8)
RUBY VERSION
ruby 3.0.1p64
......
......@@ -3,7 +3,8 @@ class UsersController < ApplicationController
before_action :correct_user, only: [:edit, :update]
def index
@users = User.all
@users = User.paginate(page: params[:page])
# @users = User.all
end
def show
......
......@@ -16,7 +16,6 @@ module SessionsHelper
if (user_id = session[:user_id])
@current_user ||= User.find_by(id: user_id)
elsif (user_id = cookies.encrypted[:user_id])
raise # The tests still pass, so this branch is currently untested.
user = User.find_by(id: user_id)
if user && user.authenticated?(cookies[:remember_token])
log_in user
......
<%= provide(:title, 'All users') %>
<h1>All users</h1>
<%= will_paginate @articles%>
<ul class="users">
<% @users.each do |user| %>
<li>
......@@ -9,3 +11,5 @@
</li>
<% end %>
</ul>
<%= will_paginate @articles%>
\ No newline at end of file
......@@ -4,11 +4,8 @@ User.create!( name: "Example User",
password_confirmation: "foobar")
99.times do |num|
name = Faker::Name.name
name = "Sample user #{num+1}"
email = "example-#{num+1}@railstutorials.org"
password = "password"
User.create!(name: name,
email: email,
password: password,
password_confirmation: password)
User.create!(name: name, email: email, password: password, password_confirmation: password)
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment