```
defindexifparams[:category].blank? @products = Product.allelse@category_id = Category.find_by(name:params[:category]).id @products = Product.where(:category_id=> @category_id)endend
```
```
defindexifparams[:category].blank? @products = Product.allelse@category_id = Category.find_by(name:params[:category]).id @products = Product.where(:category_id=> @category_id)endend
```