Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
VietTH-VenShop
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 4
    • Merge Requests 4
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tran Hoang Viet
  • VietTH-VenShop
  • Merge Requests
  • !4

Merged
Opened Jul 08, 2015 by Tran Hoang Viet@vietth 
  • Report abuse
Report abuse

VietTH: Feature search

  • Discussion 2
  • Commits 11
  • Changes
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Nguyen Ngoc Lan
    @lannn started a discussion on an old version of the diff Jul 09, 2015
    app/controllers/categories_controller.rb 0 → 100644
    1 class CategoriesController < ApplicationController
    2 before_action :set_category, only: [:show]
    3
    4 def show
    5 @products = @category.products.page(params[:page])
    6 end
    7
    8 private
    9 def set_category
    10 @category = Category.find_by(id: params[:id])
    11 redirect_to root_path, alert: "Category not found" if @category.blank?
    • Nguyen Ngoc Lan @lannn commented Jul 09, 2015
      Developer

      @vietth There are some models which you also have to rescue like: product, category,....

      There is a better way to rescue by raising error and rescue at ApplicationController

      Use Category.find to raise error. Please see example below:

      http://stackoverflow.com/questions/2336593/rescue-from-activerecordrecordnotfound-in-rails

      @vietth There are some models which you also have to rescue like: product, category,.... There is a better way to rescue by raising error and rescue at ApplicationController Use Category.find to raise error. Please see example below: http://stackoverflow.com/questions/2336593/rescue-from-activerecordrecordnotfound-in-rails
    Please register or sign in to reply
  • Tran Hoang Viet
    @vietth started a discussion on an old version of the diff Jul 13, 2015
    app/controllers/categories_controller.rb 0 → 100644
    1 class CategoriesController < ApplicationController
    2 before_action :set_category, only: [:show]
    3
    4 def show
    5 @products = @category.products.page(params[:page])
    6 end
    7
    8 private
    9 def set_category
    10 @category = Category.find_by(id: params[:id])
    11 redirect_to root_path, alert: "Category not found" if @category.blank?
    • Tran Hoang Viet @vietth commented Jul 13, 2015
      Master

      Okie, fixed.

      Okie, fixed.
    Please register or sign in to reply
  • Tran Hoang Viet @vietth

    Added 6 commits:

    • f09632a0 - VietTH: Implement rspec test for model
    • dc7a3a6d - Initialize library to deploy
    • e6e8a16c - VietTH: Apply rubocop
    • 97dbc504 - VietTH: Update info for deploy
    • 5a3bd5d8 - VietTH: Update info for deploy
    • 26aab3c8 - VietTH: Fix review code feature search
    Jul 13, 2015

    Added 6 commits:

    • f09632a0 - VietTH: Implement rspec test for model
    • dc7a3a6d - Initialize library to deploy
    • e6e8a16c - VietTH: Apply rubocop
    • 97dbc504 - VietTH: Update info for deploy
    • 5a3bd5d8 - VietTH: Update info for deploy
    • 26aab3c8 - VietTH: Fix review code feature search
    Added 6 commits: * f09632a0 - VietTH: Implement rspec test for model * dc7a3a6d - Initialize library to deploy * e6e8a16c - VietTH: Apply rubocop * 97dbc504 - VietTH: Update info for deploy * 5a3bd5d8 - VietTH: Update info for deploy * 26aab3c8 - VietTH: Fix review code feature search
    Toggle commit list
  • Tran Hoang Viet @vietth

    Status changed to merged

    Jul 13, 2015

    Status changed to merged

    Status changed to merged
    Toggle commit list
  • Tran Hoang Viet @vietth

    mentioned in commit 3b19a49d

    Jul 13, 2015

    mentioned in commit 3b19a49d

    mentioned in commit 3b19a49da10382e142e93a81f81246b83e3917a6
    Toggle commit list
  • Write
  • Preview
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 sign in to comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: vietth/VietTH-VenShop!4