lundi 9 mars 2015

ActiveRecord includes and where query giving back too many results


Vote count:

0




I am trying to write an activerecord query in my index action that only shows Trips that have a category type of "Beaches". Here is my code:



Trip.includes(:categories).where("categories.type" == "#{params[:activity]}").all


params[:activity] returns "Beaches".


That query is not doing what I Think is doing and seems to give me back all Trips. What am I doing wrong?



asked 1 min ago







ActiveRecord includes and where query giving back too many results

Aucun commentaire:

Enregistrer un commentaire