Skip to content

Instantly share code, notes, and snippets.

View rubiety's full-sized avatar

Ben Hughes rubiety

View GitHub Profile
named_scope :with_keywords, lambda {|q|
fields = %w(title information items.sku)
tokens = q.split.collect {|c| "%#{c.downcase}%"}
clause = (["(" + fields.map {|f| "#{f} LIKE ?" }.join(" OR ") + ")"] * tokens.size).join(" AND ")
{ :include => [:items], :conditions => [clause, *(tokens * fields.size).sort] }
}
@rubiety
rubiety / gist:5426
Created August 14, 2008 13:27 — forked from qrush/gist:5425
#############################################################
# Application
#############################################################
set :application, "" #your app's name here
set :server_ip, "" #your server's ip here
set :deploy_to, "/home/rails/#{application}" #the path to your rails app here
#############################################################
# Servers