Advertisement
Secretprtay

Untitled

Jan 30th, 2022
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.33 KB | None | 0 0
  1. class Category < ApplicationRecord
  2.   has_many :products, dependent: :destroy
  3.  
  4.   enum type: %i[SHOES CLOTHING BAGS ACCESSORIES WOMEN'S MEN'S KIDS CLEARANCE BRANDS]
  5.  
  6.   validates :name, presence: true, inclusion: { in: types.stringify_keys.keys,
  7.                                    message: 'not included in a specific list!' }
  8. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement