An introduction to Hybrid search
Hybrid search combines vector retrieval and BM25 keyword search to catch paraphrases and exact terms, improving recall when either method alone misses relevant documents.
You don't need a vector database to build a RAG system
RAG can work with ordinary search: relevant results are placed into the prompt, and vector embeddings are only needed when synonyms and semantic matches become the main gap.
Silencing Deprecation Warnings in Rspec
Deprecated Ruby tests can flood RSpec output with warning noise. A narrower way to quiet them avoids hiding warnings from dependencies.
When should you use DateTime and when should you use Time?
Choosing the wrong Rails date and time type can cause subtle bugs in storage, comparisons, and timezone handling. Time suits most application timestamps; DateTime is for specialized calendar use.
Use Time.current / Date.current / DateTime.current on projects that have a time zone
Time zone-aware projects need Time.current, Date.current, and DateTime.current so values persist correctly; Time.now can write timestamps with the wrong zone.
Freeze a specific Rails version
sudo apt-get install unzip
rake rails:freeze:edge RELEASE=2.2.2
Ruby: How to make your ruby library configurable
Configuring a Ruby library via a block makes endpoints and similar settings easy to override without hardcoding values.
Storing trees in databases
Tree data in relational databases can be stored with parent links, paths, nested boundaries, or closure tables; the choice trades write cost against read speed.
Always, always declare your associations with symbols
Active Record associations must be declared with symbols, especially in metaprogramming, or newer Rails versions raise an ArgumentError.
Defining custom RSpec matchers
Custom RSpec matchers support reusable test assertions, chaining, block expectations, and complex matcher classes for domain-specific checks.
JavaScript without jQuery
Moving away from jQuery improves performance, reduces bundle size, and aligns with the modern web platform. Native DOM APIs and polyfills now cover most common needs.
Rails: Have different session secrets for all environments
Using the same Rails session secret in staging and production can let a cookie from one environment authenticate in another. Separate secrets per environment reduce session hijacking risk.
RSpec: Where to put custom matchers and other support code
Custom RSpec matchers and support code need a clear home in spec/support to keep specs DRY and make shared helpers available everywhere.
Capybara: Testing file downloads
File downloads are awkward to verify with Selenium because browsers may prompt, auto-save, or render binaries instead of HTML. Alternative approaches use request specs, Rack::Test, or the browser download folder.
How to eager load a single directory with Zeitwerk
Zeitwerk can eager load a single subdirectory so descendant classes are available for iteration, while avoiding manual require of the parent file.
How to discard ActiveRecord's association cache
ActiveRecord association data can stay stale after changes; reset clears the cache without querying, while reload fetches fresh rows immediately.
Make Nokogiri use system libxml2
Nokogiri can be built against system libxml2 instead of bundled binaries, reducing rebuild work after security updates and aligning installs with patched OS libraries.
The Ruby Object Model
Ruby’s object model can be confusing for developers from static languages. Objects, singleton classes, and modules shape method lookup, class methods, and inheritance.
When using "render :text", set a content type
Rails render :text responses default to text/html, which is wrong for plain text and can trigger HTML middleware; set content_type or use render :plain.
Why developers should be force-fed state machines
Most web applications contain several examples of state machines, including accounts and subscriptions, invoices, orders, blog posts, and many more. The problem is that you might not necessarily think of them as state machines while designing your application. Therefore, it is good to have some indicators to recognize them early on. The easiest way is to look at your data model.
Matching elements on complex web pages with Webrat
XPath matchers can be combined with CSS-selector matchers. This is really useful if not, for example, the content of an element should be matched but the element itself like in the following example. Here a form is used to display data as default value in its input elements. This can be the case in web applications in which data should be edited easily without additional clicks.
PostgreSQL cheat sheet for MySQL lamers
Quick PostgreSQL command equivalents for MySQL users switching databases, listing tables, managing roles and privileges, and loading dumps.
Ruby: A small summary of what return, break and next means for blocks
return, break, and next behave differently in Ruby blocks: one exits the method, one exits the yielding method, and one skips only the current iteration.
Sending newsletters via rapidmail with SMTP and one-click unsubscribe
Newsletter delivery via SMTP with rapidmail, plus Gmail-compatible one-click unsubscribe using signed tokens and List-Unsubscribe headers.