Mô tả : Người dùng bình thường : có thể xem danh sách các thể loại Admin : có thể thêm 1 thể loại Giao diện demo : 1. Giao diện của 1 các article khi có category:
2. User bình thường :
3. Admin:
Code tương ứng :
Controller : app/controllers/categories_controller.rb Views: o app\views\categories\_category.html.erb o app\views\categories\_form.html.erb o app\views\categories\edit.html.erb o app\views\categories\index.html.erb o app\views\categories\new.html.erb o app\views\categories\show.html.erb Code show Category trong article : (app\views\articles\article.html.erb) Code yêu cầu quyền admin mới được thêm mới 1 Category : (app\controllers\categories_controller.rb)
Code quản lý Category admin tạo ra :
(db\migrate\20200512122546_create_categories.rb)
Code quản lý category người dùng tạo cho article :