2013-05-17 9 views
8

Pytanie: Czy jest możliwe, aby przetestować w warunkach hashed jeśli atrybut połączonej tabeli jest większa/mniejsza niż wartośćTest ActiveRecord Wielkopolskie/mniejszy niż wewnątrz Hash Stan

Przykład: test czy aktorów wiek jest większa niż ageVariable:

  • Czy to możliwe, aby napisać zamiast stanu ARRAY:

    ageVariable = 36<br> Movie.includes(:actors).where("actors.age > ?", ageVariable) 
    
  • HASH STAN coś takiego:

    ageVariable = 36 
    Movie.includes(:actors).where(:actors => { :age => COMPARE_LOGIC }) 
    # Where COMPARE_LOGIC is something like: (:age > ageVariable) 
    

Odpowiedz

Powiązane problemy