Where clause with includes not working

Joined
Sep 29, 2023
Messages
2
Reaction score
0
my where clasue with includes isn't working, it's returning all records instead of the expected filter
@items=Item.includes:)sales).where("unit_price is not null and item_type_id=? and title like ?, @item_type_id, params[:search] and :sales => { :item_id => nil }").order:)title)
 
Joined
Jul 4, 2023
Messages
478
Reaction score
60
BTW,
Ruby:
@items = Item.includes(:sales)
             .where("unit_price is not null and item_type_id=? and title like ?, @item_type_id, params[:search] and :sales => { :item_id => nil }")
             .order(:title)
 
Last edited:
Joined
Sep 29, 2023
Messages
2
Reaction score
0
I think it's the way I'm rendering my partial I'm causing the index action to run instead of display the results of the search action through the _items.html.erb partial
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top