class Model scope :this_month,-> { where(created_at: Time.now.beginning_of_month..Time.now.end_of_month) } end
你可以这样称呼:
Model.this_month