Skip to content

Instantly share code, notes, and snippets.

@breinz
Created August 20, 2013 13:50
Show Gist options
  • Save breinz/6281721 to your computer and use it in GitHub Desktop.
Save breinz/6281721 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
def self.all_foos(age=nil)
req = where(name: "foo")
req.where(age: age) if !age.nil?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment