John Merlino wrote in post #1021280:
> Hey all,
>
> This example of working code:
>
> @a = @b.where(:a_group_id.ne => nil).collect { |b| b.a_group }
>
> doesn't make too much sense to me. For one, I am not sure what that
> "ne" is doing there. Is this a postgresql thing? Second, it looks like

The "ne" is Arel's version of "Not Equal." So that's ":a_group_id not 
equal to nil"

> we are collecting active record objects where the a_group_id is null,
> collecting them in an array and then invoking the a_group association
> method on it to get its association. That doesnt make sense because
> the fact that we collected objects which had no association, how can
> we invoke the association method on it?

@a will contain a collection of the associated objects for records where 
the associated object exists (is not nil).

-- 
Posted via http://www.ruby-forum.com/.

-- 
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-talk@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