Commit 2aec1fc0 by Mai Hoang Thai Ha

bugs

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