Hello, I've been looking for a way to noop a find_all_by. Use case: I have a function that takes a hash called options as argument, and that operates on a subset of Host objects as such: """ client_id = options[:client] ? Client.find(options[:client]) : nil old_hosts = client_id ? Host .last_seen_before (minutes.minutes.ago).find_all_by_client_id(client_id) : Host.last_seen_before(minutes.minutes.ago) """ last_seen_before is a named_scope. If I had a noop for the find_all_by_client_id, I could make due of the client_id ? : part in the second line.
I admit that this is quite a simple a case, and that it doesn't add much complexity to the program, but I'll soon have to add some more filters and/or scopes, and I'd hate to make different calls depending on whether the option is set or not. Does anyone know a way to make this less painfull? Thanks, Felix --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

