Ruby on Rails Wednesday, November 26, 2014


On Wed, Nov 26, 2014 at 4:07 PM, Colin Law <clanlaw@gmail.com> wrote:
Groups.first.messages.where(:created => '11-11-2014').tags

By the way, if you mean :created_at then this will not work as
created_at includes the time, so to get an exact match on 11-11-2014
it would have to be exactly midnight.  You will have to use a time
range, and don't forget to watch out for the timezone.

​Hi Colin,

Thanks for your reply. This won't work since messages would return an ActiveRelation there is no tags method on an active relation.

In my actual code I will use a between two days. I just used a direct equals for simplicity sake​

Thanks,
Ganesh

--
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/CALFmRoFVYaOFXXZkar4aZYnh3WGzc9OEXTB_8AdK1SUUSRno4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment