rubyism: splatting for the good of mankind
In the midst of writing some ever expanding SQL queries I found places where I was passing the same variable to multiple conditions so I ended up with this:
[user.id, user.id, user.id, user.id]
Not the prettiest girl at the dance but she can shake her hips when she has to. Still I think we can make it smaller and more Ruby-ish.
ids = [user.id] * 4
Better, now only an integer has to change if we need to add or remove one of the id variables.
Here is a better representation of this thinking in code:
https://gist.github.com/bjh/5637436
Is it better or worse? not sure but it is certainly much more fun...















