Your approach seems very insecure (unless you have absolute, total control of the queries in the db) and not very maintainable in the long run (e.g. a change in the db structure invalidates all queries that use it and you'd need to check all of them if they are still ok).
So, I would not do that, but if you insist, you can use class_eval on the model class:
Model.class_eval('select("clause").where(id: permitted_params[:id]).group("date(transaction_date)')
is equivalent to:
Model.select("clause").where(id: permitted_params[:id]).group("date(transaction_date)")
But still, I'd vote against this approach: you say you need to query different types of products. There usually is a way to abstract such info into a few attributes and perhaps some join tables. Something like: a product can have many features and each feature has a name, type, etc... This would be the way to go for me. The long-term advantage is also that you would be building a detailed description of the product in your code / db which may come handy for various purposes later.