Ruby on Rails Thursday, October 22, 2015

On 22 October 2015 at 10:59, Quake Live <lists@ruby-forum.com> wrote:
> Hello guys,
>
> is it possible to "customize" filter specific SQL-queries? Maybe in the
> wice_grid_config.rb ?
>
> If so then tell me how please.
>
> To mention the problem i have, here it comes:
>
> I want to filter some records of a specific table, let say the name of
> the table is clients.
>
> The filter i want to use is the date->to filter.
> The problem is that if I use it, let say for the date "02.04.2015" then
> it will look for all dates "< 02.04.2015".
>
> But i want it to be "<= 02.04.2015".

I am assuming that the date is actually a datetime field, you should
be able to do
Client.where(date < some_date+1.day)
That also assumes that some_date is a Time set to the start of a day.
In addition you have to watch the timezones of course.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLt6DqbPc8a-U8w%3Dvdg4w4_JB9urAmcFH06DCx9iqeWaFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment