> Mongoid uses association proxy objects. It overrides #nil? => false > when the association is missing. However since it uses proxy > objects, !!assocation is always true.
This is why active record doesn't use proxy objects for nil belongs_to and has_one associations, you can't override the boolean value of your objects. > > I have created a ticket with a patch that changes the association nil > test to call assocation.nil? rather than use implicit coercion of the > variable. These proxy objects don't follow correct ruby semantics and I'm not entirely sure that we should take the performance hit to work around that bug. There are bound to be other places where we use this form and we're not going to fix all of them. -- Cheers Koz -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-c...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.