Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
[Idea] Calculating variable value based on Ruby code before performing SQL query #216
Hello. Thanks for this wonderful gem! One of the ways we're looking into using it is to make it easier to look up users (without having to SSH into our production server and fire up a Rails console). We look up users by their email address when they email our support team. The problem is that emails are encrypted in the DB, so we have a custom look up method
It would be great to be able to use a variable-based query like
Another option could be to allow creating queries based on Ruby code instead of SQL, so you would have one query to generate the fingerprint, then you could enter the fingerprint in the variable-based query that runs
Any other ways this can be achieved?
Hey @monfresh, thanks for the suggestion
Blazer.transform_variable = lambda do |name, value| value = User.compute_fingerprint(value) if name == "email_fingerprint" value end
I've added this on the transform_variable branch. Let me know what you think.