日期增压器
日期查询的快捷方式。
日期增压器将_between , _between_inclusive , _after , _after_or_at , _before和_before_or_at方法添加到Active Record模型的每个日期/日期时间字段。
用法
之间
Visit . created_at_between ( from , to )
代替
Visit . where ( "created_at >= ? AND created_at < ?" , from , to )
### between_inclusive
Visit . created_at_between_inclusive ( from , to )
代替
Visit . where ( "created_at >= ? AND created_at <= ?" , from , to )
评论0
最新资源