Skip to content

Instantly share code, notes, and snippets.

View bradgessler's full-sized avatar

Brad Gessler bradgessler

View GitHub Profile
@ioquatix
ioquatix / connections.md
Last active April 10, 2026 22:13
Show how `with_connection` and `lease_connection` interact.

Permanent Connection Checkout

Rails 7.2 defaults:

Highscore.connection
# => #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x000000000080e8 env_name="development" role=:writing>

With config.active_record.permanent_connection_checkout = :disallowed:

@eric1234
eric1234 / chronic_integration.rb
Last active February 17, 2021 20:20
chronic/ruby/rails integration
# https://gist.github.com/eric1234/3739149
#
# Mass monkey-patching! Provides integration between Chronic, Ruby and
# Rails. So now these all work:
#
# Date.parse "next summer"
# DateTime.parse "in 3 hours"
# Time.parse "3 months ago saturday at 5:00 pm"
#
# In addition we override String#to_date, String#to_datetime, String#to_time.