I have a Rails 3 scope that excludes an array of ids.
What is the best way to write the scope so that it does nothing when the array is empty and is still chainable? I c
How about the following? (It still checks for an empty array though, so if that's what you're trying to avoid it's not much of an improvement :)
scope :excluding_ids, lambda {|ids| (ids.empty? && relation) || where('id not in (?)', ids) }