I have an array of strings that are to serve as params for a where call in a model.
How do I append each of the strings in the models where call and return the active record relation for an additional limit call
I have tried the following but it only adds the first item to the where clause
array = ['active = true', 'expired = false', 'created_at > 2017-04-18 10:36:28']
array.reduce { | item | Post.where(item) }
returns
Posts.where('active = true')
whereas am begging for
Posts.where('active = true').where('expired = false').where('created_at > 2017-04-18 10:36:28')
Thanks.