Skip to content

Instantly share code, notes, and snippets.

Bohdan Schepansky alfuken

View GitHub Profile
View search_with_scopes.rb
# Untested, but it should work :)
class Something < ActiveRecord::Base
# Simpler approach available with this small Rails patch:
# http://rails.lighthouseapp.com/projects/8994/tickets/1773-allow-returning-nil-from-a-named_scope-lambda
#
# named_scope :with_town_like, lambda { |term|
# { :conditions => ['town LIKE ?', term] } unless term.blank?
# }
#
You can’t perform that action at this time.