4 ms·
Glad to see some support on the gem list. That was one of the items I really hadn't seen discussed anywhere else and was wondering if it only bothered me. I did
by BrianVanLoo 12y ago
Glad to see some support on the gem list. That was one of the items I really hadn't seen discussed anywhere else and was wondering if it only bothered me. I did some dev ops for a project that turned out to be what would have sounded like a fairly simple, small Rails app on a rather low-traffic site. I kept having to increase the server instance size as the team cargo-culted more and more gems into the Gemfile and the multiple Rails executables run under Unicorn continued to grow in size and eventually run out of memory on the server.
I agree that my example using OpenStruct only moves the conditional but in this case it moves it out of a place where I find conditional logic much harder to reason about. Also, if there were more attributes than just name that come out of that object you could potentially be eliminating many more conditionals with just the one in current_user which also seems like a win.