Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- validates_uniqueness_of :mobile
- validates_uniqueness_of :email
- validates_uniqueness_of :card_num
- name mobile email card_num
- ============================================
- Mary 65666678 mary@gmail.com A001
- name mobile email card_num
- ============================================
- Peter 65666678 peter@gmail.com A002
- name mobile email card_num
- ============================================
- Peter 74009822 mary@gmail.com A002
- name mobile email card_num
- ============================================
- Peter 65666678 mary@gmail.com A001
- User.select("CASE
- WHEN (name = 'Peter') THEN 'name'
- WHEN (mobile = '74009822') THEN 'mobile'
- WHEN (email = 'mary@gmail.com') THEN 'email'
- ELSE 'card_num'
- END as col_name").where("name = 'Peter' or mobile = '74009822' or email = 'mary@gmail.com' or card_num='A002'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement