Skip to content

Instantly share code, notes, and snippets.

@jfernandez
Created September 9, 2009 21:15
Show Gist options
  • Save jfernandez/184087 to your computer and use it in GitHub Desktop.
Save jfernandez/184087 to your computer and use it in GitHub Desktop.
named_scope :for, lambda { |reason|
(reason ? { :conditions => { :payment_reasons => { :reason_type => (reason.is_a?(Array) ? reason.first.class.name : reason.class.name), :reason_id => reason }}, :include => [:payment_reasons] } : {}) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment