I have a Model Product with fields:
name price product_type_id:integer size:string page_quantity:integer.
How can make this validation work for Product model create action?
- if product_type.id == "1"
validates :size, presence: true
validates :page_quantity, presence:false
- else
validates :size, presence: false
validates :page_quantity, presence:true
end