Skip to content

Instantly share code, notes, and snippets.

@cassiomarques
Created November 18, 2008 00:40
Show Gist options
  • Save cassiomarques/26005 to your computer and use it in GitHub Desktop.
Save cassiomarques/26005 to your computer and use it in GitHub Desktop.
named_scope :a_receber, :conditions => {:pagar_receber => RECEBER}
named_scope :a_pagar, :conditions => {:pagar_receber => PAGAR}
named_scope :do_cliente, lambda {|cliente| {:conditions => ["cliente_id = ?", cliente.is_a?(Fixnum) ? cliente : cliente.id]}}
named_scope :da_escola, lambda {|escola| {:conditions => ["escola_id = ?", escola.is_a?(Fixnum) ? escola : escola.id]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment