dimanche 12 avril 2015

Ruby on Rails Select with date range

I am trying to get the following sentence to work,



User.all.select{ |user| user.created_at === DateTime.yesterday..DateTime.today }

User.all.select{ |user| user.created_at == DateTime.yesterday..DateTime.today }

User.all.select{ |user| user.created_at => DateTime.yesterday..DateTime.today }


This doesnt works and prompts a bad value for range error.


I am aware that there are more efficient ways to accomplish this and get the same results, but im interested in how to get a select work with a date range


1 commentaire:

  1. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here
    Thank you. Your blog was very helpful and efficient For Me,Thanks for Sharing the information Regards..!! Ruby on Rails Online Training Hyderabad

    RépondreSupprimer