码迷,mamicode.com
首页 > 其他好文 > 详细

rails gem ransack 之模糊搜索

时间:2018-05-31 19:09:03      阅读:374      评论:0      收藏:0      [点我收藏+]

标签:font   gre   mon   ESS   present   email   esc   name   null   

gem ‘ransack‘

PredicateDescriptionNotes
*_eq equal  
*_not_eq not equal  
*_matches matches with LIKE e.g. q[email_matches]=%@gmail.com
*_does_not_match does not match with LIKE  
*_matches_any Matches any  
*_matches_all Matches all  
*_does_not_match_any Does not match any  
*_does_not_match_all Does not match all  
*_lt less than  
*_lteq less than or equal  
*_gt greater than  
*_gteq greater than or equal  
*_present not null and not empty e.g. q[name_present]=1 (SQL: col is not null AND col != ‘‘)
*_blank is null or empty. (SQL: col is null OR col = ‘‘)
*_null is null  
*_not_null is not null  
*_in match any values in array e.g. q[name_in][]=Alice&q[name_in][]=Bob
*_not_in match none of values in array  
*_lt_any Less than any SQL: col < value1 OR col < value2
*_lteq_any Less than or equal to any  
*_gt_any Greater than any  
*_gteq_any Greater than or equal to any  
*_matches_any *_does_not_match_any same as above but with LIKE
*_lt_all Less than all SQL: col < value1 AND col < value2
*_lteq_all Less than or equal to all  
*_gt_all Greater than all  
*_gteq_all Greater than or equal to all  
*_matches_all Matches all same as above but with LIKE
*_does_not_match_all Does not match all  
*_not_eq_all none of values in a set  
*_start Starts with SQL: col LIKE ‘value%‘
*_not_start Does not start with  
*_start_any Starts with any of  
*_start_all Starts with all of  
*_not_start_any Does not start with any of  
*_not_start_all Does not start with all of  
*_end Ends with SQL: col LIKE ‘%value‘
*_not_end Does not end with  
*_end_any Ends with any of  
*_end_all Ends with all of  
*_not_end_any    
*_not_end_all    
*_cont Contains value uses LIKE
*_cont_any Contains any of  
*_cont_all Contains all of  
*_not_cont Does not contain  
*_not_cont_any Does not contain any of  
*_not_cont_all Does not contain all of  
*_true is true  
*_false is false  

 

rails gem ransack 之模糊搜索

标签:font   gre   mon   ESS   present   email   esc   name   null   

原文地址:https://www.cnblogs.com/lv-books/p/9117969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!