-
Notifications
You must be signed in to change notification settings - Fork 12
Chapter 7 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Chapter 7 #6
Conversation
ready |
1 similar comment
ready |
@@ -41,6 +41,7 @@ gem "tzinfo-data", platforms: %i(mingw mswin x64_mingw jruby) | |||
|
|||
# Reduces boot times through caching; required in config/boot.rb | |||
gem "bootsnap", require: false | |||
gem 'bcrypt', '3.1.18' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chú ý convention dùng nháy " hết cho file này nhé
gem 'bcrypt', '3.1.18' | |
gem "bcrypt", "3.1.18" |
gem 'sassc-rails' | ||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Đưa cái cụm này lên viết liền block trên cùng trước line 52 nè em
input { | ||
height: auto !important;} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mấy cái lỗi end line nè, 1 line trống dưới cùng trong file, xóa hết space nếu có để nó hiểu line đó là line trống nha. Tìm hiều cách config visual studio code để nó tự động thêm end line cuối file, đỡ bị lỗi về sau nè
@@ -0,0 +1,29 @@ | |||
class UsersController < ApplicationController | |||
def show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thông thường 1 indent trong rails thì dùng 2 space cho 1 tab thôi e ơi, cái này có thể thiết lập trong vs code được đó e
@user = User.find_by id: params[:id] | ||
return if @user | ||
|
||
redirect_to root_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chỗ này trước khi redirect thì thêm flash message lỗi không tồn tại user nữa nhé
redirect_to root_path | |
flash[:error] = "Error ...." | |
redirect_to root_path |
<a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a> | ||
sample application. | ||
</p> | ||
<%= link_to "Sign up now!", "#", class: "btn btn-primary btn-lg" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n cho title của button/link các thứ e nhen
</ul> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
các thụt indent vào đang lộn xong nè em, ví dụ như bên dưới là sẽ thấy được phân cấp cha con nhen
</ul> | |
</div> | |
<div> | |
<ul> | |
</ul> | |
</div> | |
@@ -0,0 +1,55 @@ | |||
# MySQL. Versions 5.5.8 and up are supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Tạo 1 file mới từ file này, đặt tên là config/database.yml.example và xóa đi các nội dung value của username/password e nhé
- Đưa file config/database.yml vào gitignore để không đẩy lên github, lộ hết thông tin nhen
get 'pages/home' | ||
get 'pages/help' | ||
get 'pages/contact' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dùng nháy " cho file này nhen
@@ -0,0 +1,4 @@ | |||
class AndGenderToUsers < ActiveRecord::Migration[7.0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file này ko có nội dung change gì thì xóa e nhé
commented |
WHAT (optional)
-Thêm chức năng đăng ký tài khoản, hiển thị lỗi khi đăng ký thất bại và thông báo khi đăng ký thành công.
HOW
-Tạo form đăng ký với các trường: tên, email, mật khẩu, xác nhận mật khẩu, giới tính.
-Kiểm tra tính hợp lệ của dữ liệu đầu vào (ví dụ: email đã tồn tại, mật khẩu quá ngắn, thiếu thông tin).
-Hiển thị lỗi khi người dùng nhập sai hoặc thiếu thông tin.
-Hiển thị thông báo chào mừng và thông tin tài khoản khi đăng ký thành công.
WHY (optional)
-Trước đây, ứng dụng chưa có tính năng đăng ký tài khoản.
-Cần bổ sung kiểm tra dữ liệu đầu vào để tránh sai sót khi người dùng nhập thông tin.
-Cải thiện trải nghiệm người dùng bằng cách hiển thị thông báo rõ ràng khi đăng ký thành công hoặc thất bại.
Evidence (Screenshot or Video)
-Hình ảnh form đăng ký thất bại với các lỗi hiển thị.

-Hình ảnh giao diện sau khi đăng ký thành công.

Notes (Kiến thức tìm hiểu thêm)
-Cách xử lý validation trong Rails (validates).
-Cách hiển thị lỗi khi nhập sai thông tin trong form.
-Cách sử dụng flash messages để hiển thị thông báo cho người dùng.