How can I search date range in Rails with variable date

后端 未结 4 1563
忘掉有多难
忘掉有多难 2020-12-17 16:33

How can I do this in rails active record¿?

find all models that match (created_at + 100 days between this month)

Edit: Ok, Sorry for not be precise this what

4条回答
  •  粉色の甜心
    2020-12-17 17:13

    In Rails 3 you can use:

    YourModel.where(:created_at => start_date..end_date)
    

    where start_date and end_date are Date class.

提交回复
热议问题