I think you’re missing an
attr_reader :users in this class.
@users = users
But on another note, I like the idea of passing in just the users that are needed, but if you’re passing in the list of all users and then whittling it down, wouldn’t that be an extreme waste of cpu time? Probably doesn’t matter for users, but for whatever your business actually does it could be very bad.
Unless you’re relying on passing a lazy collection reference, but that seems like it’s violating some rule about passing native things instead of complex objects/hashes/references (but I don’t know the name for this rule or if it’s even a rule).
What am I missing?
Btw, I really like this article even though I had complaints. I’m definitely going to change how I do use my before filters and I love the idea of passing locals. This is really nice!
Any thoughts about how to control other types of global state like Rails.application.config? That’s one that I’ve been trying to figure out how to test recently.