I am trying to select an array, and check and see if any object That's wrong. If any one of them is a liar, then I need a final value in false exchange.
If all is true, then I want to return the truth ..
Here I have what is ..
is valid_pressings_off: email,: If = & gt; Proc.new {| User | User.organizations.find (: all) .select {| Org | Org.contact_24}} This unfortunately just gives the array
How do you do it?
Check in DB, Is present? The method ensures that all calculations are done on the DB rather than the client code.
is valid_presses_off: email ,: as long as & gt; Proc.new {organizations.exists? (: Contact_24 = & gt; wrong)} If you still insist on doing this on the client side:
Validates_presence_of: Email, : Until = & gt; Proc.new {organizations.any? {| O | | O.contact_24! = True}}
Comments
Post a Comment