On Jan 26, 6:41 pm, Pablo Gonzalez <li...@ruby-forum.com> wrote:
> I'm trying to use the :group option in an ActiveRecord association. I
> wrote the code as follows:
>
> class User < ActiveRecord::Base
>   has_many :messages, :group => "thread", :order => "created_at desc"
> end
>
> It works fine as it returns some records. The problem is that the mysql
> clause "GROUP BY" ignores NULL values. That makes that records with
> thread == NULL not to show.
>
> ¿Is there a rails option to include NULL values when using :group?
>

Given that the underlying DB doesn't appear to support the operation,
I'd say not. Even if it did, the result would be that you'd only get
the most recent post with thread == NULL, which doesn't seem like what
you'd want.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to