ruby on rails - Models where HABTM exists for all of the child models in search_array -
suppose search_array = [1, 3, 6]
, model
has_and_belongs_to_many childmodels
i want return models
have habtm link all of childmodels
in search_array
.
my code, asked
# find drivers driver has of availables in array chunk = start block_ids = [] while chunk <= ending block_ids << block.where(hour: chunk.hour, day: chunk.wday).take.id chunk += 1.hour end drivers = drivers.where( availables: block_ids ) # line issue
currently, code find drivers driver has of availables in array block_ids
Comments
Post a Comment