Grouping created_at by date only?
activerecord, ruby-on-rails-3
Solution
def grouped_created_at
@created_ats = @products.group_by { |c| c.created_at.to_date }
end
Problem
I have the following in my Product model. ``` def grouped_created_at @created_ats = @products.group_by { |c| c.created_at } end ``` Works fine, but I want to group by the date only. As this is a timestamp, i'm not getting the results I need. Can anyone advise how to modify this? Many thanks!