Skip to content

Instantly share code, notes, and snippets.

@jonasschmidt
jonasschmidt / pre-commit
Last active August 17, 2018 06:55
git pre-commit hook checking for RSpec :focus tags that were unintentionally left in the specs
#!/usr/bin/env ruby
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
Failures:
1) offer searching by country code
Failure/Error: run_delta_index
ActiveRecord::StatementInvalid:
Mysql2::Error: Unknown column 'weekly_rate_in_currency_cents' in 'field list': SELECT id, "Offer" AS type, title, description, lat, lng, city, zip, country, street, is_public, findable, price_score, availability_score, conversion_score, farmer_score, roi_conversion_rate_last_90days, displays_last_90days, deleted_at, nightly_rate_in_currency_cents, weekly_rate_in_currency_cents, monthly_rate_in_currency_cents, service_charge_in_currency_cents, photos_count, min_nights, max_nights, max_guest_count, status, visibility, user_id, extra_guest_charge_in_currency_cents, country_code_iso, created_at, updated_at, first_published_at, currency, code, object_type, included_guest_count, main_photo_id, suburb, bedroom_count, min_delay, external_source FROM offers WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8)
# ./app/modules/offer_index.rb:420:in `query_db'
# ./app/modules/offer_index.rb:186:in `in