Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4631

Ransack query is returning wrong quantity of objects

$
0
0

I have this ransack query:SchoolTeacher.ransack(school_classrooms_id_eq: 1134).result.count

it should filter objects of SchoolTeacher where classroom_id os 1134.SchoolTeacher belongs_to School.School has_many Classrooms.

it should return 1 object, but returns 923, it is like the query is ignored and is returning to me all the objects of a certain school.

I tried to write this code using where, but returns the same quantitySchoolTeacher.joins(school: :classrooms).where(classrooms: { id: 1134 }).count


Viewing all articles
Browse latest Browse all 4631

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>