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.

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.

Isolate Side Effects in Ruby

Side effects are necessary but make Ruby code harder to test and reason about; isolating them reduces coupling and keeps core logic predictable.

Standalone Cucumber Test Suite

Sometimes you inherit a non Rails or non Rack based web app such as PHP, Perl, Java / JEE, etc. I like using cucumber for functional testing so I put together this project structure to use as a starting point for testing non Ruby web based applications.

Test if a checkbox is checked in jQuery

jqueryElement.is(':checked')

7 Fresh and Simple Ways to Test Cross-Browser Compatibility | Freelance Folder

In this article we’ve listed 7 fresh and simple tools for cross-browser compatibility testing, tools that actually make this stuff pretty easy. Not only that, but every single one of these tools can be used for free.

Celerity | Easy and fast functional test automation for web applications

Celerity is a JRuby wrapper around HtmlUnit – a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerity aims at being API compatible with Watir.

Ultimate rspec matcher to test named_scope or scoped - Web development blog

What do we expect from the custom finder? We expect that it should find assets A, B, C and should not find assets D, E, F. And sometimes the order is important: it should find A, B C with exact order.

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.

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.

List of Helpful RubyMine Shortcuts

RubyMine keyboard shortcuts speed navigation, multi-caret editing, refactoring, and file handling for everyday Ruby development tasks.

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.

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.

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.

Middleman configuration for Rails Developers

Rails-friendly Middleman setup for live reload, asset pipeline, i18n, environment-specific config, browser testing, and Capistrano deployment.

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.

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.

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.

RubyMine: Efficiently filtering results in the "Finder" overlay

RubyMine Finder searches can return huge result sets; file masks, directory limits, regex, and other filters narrow matches and speed up locating the right code.

Do not use transparent PNGs for iOS favicons

Transparent apple-touch-icon images on iOS turn black in Safari, so solid backgrounds prevent ugly home-screen and bookmark icons.

RSpec: Executing specs by example id (or "nesting index")

Running one RSpec example without line numbers avoids fragile file-position matches when specs change. Example ids, also called nesting indexes, target the example tree directly.