Pitfall: ActiveRecord callbacks: Method call with multiple conditions
Conditional after_save callbacks can silently lose earlier :if conditions when the same method is registered twice. Combine predicates or move the logic into the callback.
Configuring ActionMailer host and protocol for URL generation
ActionMailer URL generation fails without a configured host and protocol. Rails can use hardcoded defaults or derive them from the request for mailers sent outside the request cycle.
RSpec: How to turn off partial double verification temporarily
RSpec partial double verification blocks stubbing helper methods that come from Rails controllers; without_partial_double_verification or a spec config can disable it temporarily.
Gatekeeping: Guide for developer
Developer workflow for review-gated changes in Linear and GitLab, with branch, merge, reject, and staging steps to reduce client rejections.
Reflective Surface ยป Tests: Pragmatism or ideology?
The argument that using tests is a ideologic waster of time fails when one considers how it can help to insure architectural decisions.
Should I test for translated strings?
I brought up the question whether tests should call the translation API when checking for the presence of a string.
Alex Miller - Unit tests are a drop cloth
Unit tests are to refactoring like a drop cloth is to painting. Both feel like more work at first but ultimately save you time by allowing you to move faster.
How to test a confirm dialog with Cucumber? - Stack Overflow
Seems like there's no way to do it in Capybara, unfortunately. But if you're running your tests with the Selenium driver (and probably other drivers that support JavaScript), you can hack it
How to turn images into inline attachments in emails
External images in emails can fail in some clients; inline attachments with Rails and attachments.inline keep images visible, but turn messages into multipart emails and use content IDs.
Using the Truemail gem to validate e-mail addresses
Email address validation inside the app avoids external SaaS dependencies and can catch bad domains before sign-up. DNS-based checks with MX-only lookup balance reliability and safety better than SMTP probing.
Rails: Looking up constants by their name string
Rails constantize and safe_constantize turn strings into constants, but untrusted input can resolve dangerous classes; validate with an allowlist first.
How to simulate limited bandwidth in Google Chrome and Firefox
Slow network conditions can be reproduced for web app testing with browser devtools or trickle, revealing issues on mobile and other constrained connections.
RubyMine: Find and Replace with Regex (Capture Groups and Backreferences)
Regex find-and-replace in RubyMine uses capture groups and backreferences to rewrite quoted text, URLs, and old RSpec syntax safely.
Building web applications: Beyond the happy path
Web apps fail on devices, browsers, slow networks, large data, and printing when responsive design, loading states, image handling, and metadata are neglected.
How to use html_safe correctly
html_safe marks strings for unescaped insertion in Rails views, but does not unescape content; misusing it on user input can enable XSS.
When loading Yaml contents in Ruby, use the :freeze argument to deep-freeze everything
YAML.safe_load and YAML.safe_load_file can deep-freeze parsed YAML with freeze: true, keeping configuration data fully immutable; ... .freeze leaves nested objects mutable.
List of Helpful RubyMine Shortcuts
RubyMine keyboard shortcuts speed navigation, multi-caret editing, refactoring, and file handling for everyday Ruby development tasks.
Do not forget mailer previews
Mailer previews often break when mailer code changes, and automated checks can catch missing updates before they reach development workflows.
Middleman configuration for Rails Developers
Rails-friendly Middleman setup for live reload, asset pipeline, i18n, environment-specific config, browser testing, and Capistrano deployment.
How to run a small web server (one-liner)
Quickly serve a local folder for testing, or boot a Rack app, with one-line commands in Ruby, Python, Passenger, or Puma; HTTPS is possible too.
Some tips for upgrading Bootstrap from 3 to 4
Migrating a larger Rails app from Bootstrap 3 to 4 often breaks styles, components and helper gems; planning library upgrades and rebuilding variables reduces the pain.
Unpoly: Showing the better_errors page when Rails raises an error
AJAX errors in Unpoly can hide the full better_errors page in Rails development. A fallback full-page reload restores the interactive error view and CSS.
Rails: Testing the number of database queries
N+1 queries and excessive eager loading can be caught by asserting exact database query counts in specs with the make_database_queries RSpec matcher.
SameSite cookies
Browser defaults are shifting toward SameSite=Lax, making cross-site cookie behavior stricter and exposing iframe, API, and non-GET request flows that need SameSite=None or Strict.