Skip to content

Instantly share code, notes, and snippets.

@jferris
Created February 20, 2009 22:48
Show Gist options
  • Save jferris/67763 to your computer and use it in GitHub Desktop.
Save jferris/67763 to your computer and use it in GitHub Desktop.
User.admins # return all admins
User.editors # return all editors
User.admins.editors # return all users that are admins and editors
User.not.admins # return all users that are not admins
User.admins.or.editors # return all users that are admins or editors
class Job < ActiveRecord::Base
def search(options)
Job.
active.unless { options[:include_inactive] }.
group {|jobs|
jobs.
titled(options[:title]).or.
matching_company_name(options[:company]).or.
tagged_with(options[:tags])
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment