Hi Jacob,

that sounds cool and maybe easy enough for a first Rails contribution 
(which I also never did but would like to). Do you 
know https://github.com/jeremyevans/sequel ? With Sequel you can do stuff 
like

posts.where(:stamp => (Date.today - 14)..(Date.today - 7))

which seems quite intuitive. Maybe we can just port that.

Jakub


On Saturday, February 13, 2016 at 1:23:09 AM UTC+1, Jacob Smith wrote:
>
> Often times, doing a query involves time based methods: "All users updated 
> within the last 6 months", "All posts older than 1 year", etc.
>
> My proposal is for an ActiveRecord helper method that would allow those 
> queries to be written in a way similar to:
>
> Users.where(updated_at: within(6.months))
>
> Posts.where(updated_at: older_than(1.year))
>
> Obviously that syntax may have to change to work with ActiveRecord/Arel.
>
> I have been a Rails developer for about 3 years, so I'm very comfortable 
> with Rails and ActiveRecord, though I have never contributed before. I am 
> open to any and all suggestions or comments. I looked and didn't see any 
> similar proposals in Github issues, though I may have missed something. If 
> there is positive feedback on this, I would love to take a stab at it and 
> let that be my first contribution back to Rails and, with that, if you have 
> any advice on actual implementation considerations, I would love to hear 
> those ideas, too!
>
> Thanks,
> Jacob
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to