ruby on rails 3 - ActiveRecord Query Where Last has_many Record Matches -
I have a class, we can contact with a number of changes ...
The class contact has_many: contact for transition ... and class transition ... and What I want to do is find out all those contacts whose last < / Em> In transit 'system', obviously, there is a display_ by column in the transition that can be 'system' or 'user' Sh am, but really what I need. I'm thinking from something ... get contact ((transition). Where ('transitions.performed_by =', 'system') but it will receive all those contacts who have any infection with 'system' And I only believe that you can try this
Code> contact = contacts.first contact.transitions.where (: performed_by = & gt; 'system'). Previous
Comments
Post a Comment