Skip to content

Instantly share code, notes, and snippets.

Bohdan Schepansky alfuken

Block or report user

Report or block alfuken

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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.