What do you think about constantize in Ruby?
Mohamed Zakarya
0 replies
We started using contantize to perform more dynamic queries in our Rails app. What are your thoughts about it?
def dynamic_find_by_id(model:, id:)
model.constantize.find_by_id(id)
end
dynamic_find_by_id(model: 'ModelName', id: 1)
🤔
No comments yet be the first to help
No comments yet be the first to help