I have table Offer
who have one OfferDescription
dependence with activities stores like this:
t.boolean "discovery", default: false
t.boolean "meeting_animals", default: false
t.boolean "milking_animals", default: false
t.boolean "tasting", default: false
t.boolean "birth_animal", default: false
t.boolean "stroll", default: false
t.boolean "harvest", default: false
t.boolean "craft", default: false
My users can search Offers by activities, its ok when they select only one activity i did the request like this
activity = params[:activity].gsub(/'/, '')
.joins(:address, :offer_description)
.where("max_people_count >= ? AND offer_descriptions.#{activity}=?", peopleCount, true)
.near(location, distance, unit: :km)
But how i can do properly when they select multiple activities to find Offers who have this activity OR another one ?
The way the OfferDescription
table was made look little bit strange for me
question from:
https://stackoverflow.com/questions/66062512/find-records-with-multible-column-name-in-rails 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…