Skip to content

Instantly share code, notes, and snippets.

@spint
Created December 10, 2010 10:07
Show Gist options
  • Save spint/736043 to your computer and use it in GitHub Desktop.
Save spint/736043 to your computer and use it in GitHub Desktop.
class LowCoverReport < ActiveRecord::Base
# This seems to be working fine, but is it the "right" way to achieve this ?
@@country_query = lambda{|o| {:conditions => ["country_id IN (#{o.countries.collect{|c| c.id}.join(', ')})"]} }
named_scope :for_user, @@country_query
named_scope :for_session, @@country_query
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment