Skip to content

Instantly share code, notes, and snippets.

View omghax's full-sized avatar

Dray Lacy omghax

  • Envy Labs
  • Orlando, FL
View GitHub Profile
def self.text_search(query)
if query.present?
fulltext_columns = ['vechicles.make', 'vehicles.model']
fulltext_columns += columns.select do |col|
col.type == :string || col.type == :text
end.collect do |col|
"lot_vehicles.#{col.name}"
end
conditions = fulltext_columns.collect { |col| "#{col} @@ :q" }.join(' OR ')
joins(:vehicle).where(conditions, :q => query)
@omghax
omghax / hswitch.rb
Created July 11, 2011 15:41 — forked from tylerhunt/hswitch.rb
Switches Keys for Multiple Heroku Accounts
#!/usr/bin/ruby
require 'fileutils'
require 'pathname'
account = ARGV.first
unless account
puts "Usage: #{File.basename(__FILE__)} <account>"
exit(1)
end