Maintaining custom application tasks in Rails

Large Rails projects benefit from keeping application tasks slim, separating the executable wrapper from the business code, and testing both rake tasks and scripts.

Unpoly 3.7.1, 3.7.2 and 3.7.3 released

Bug fixes for Unpoly 3.7.1–3.7.3 address lost form input, validation race conditions, autosubmit regressions, and fragment targeting issues in complex asynchronous flows.

CSS: Letting text flow around a round element

Wrap text around a circular element by floating it and using shape-outside with content-box; matching shape-margin to the element margin keeps spacing consistent.

Cucumber step to match table rows with Capybara

Cucumber step for checking table rows in Capybara, with optional exact matching, row order control, wildcards, and support for colspan or rowspan tables.

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.

Copying validation errors from one attribute to another

Virtual attributes can need validation messages shown on a different field, especially with Paperclip attachments and related file-name checks.

Rails: Using custom config files with the config_for method

Global Rails settings can live in YAML files with environment-specific overrides via config_for, avoiding constant collisions and supporting fetch or bang accessors.

Dockerfile and Heredocs

BuildKit heredocs make Dockerfile multiline commands easier to read, but compatibility with older clients and unclear command chaining limit practical use.

Browser debugging tricks

Useful browser devtools techniques for finding tricky JavaScript bugs, inspecting calls, and pausing execution on changes to state, URLs, or DOM properties.

RubyMine: Real-time Collaborating in the IDE

Collaborative coding in RubyMine lets others join your editor for pairing, review, or shared terminal access, with permissions from read-only to full access.

Ignore commits when git blaming

git blame output can be noisy after formatting or mass-renaming commits. --ignore-revs-file keeps selected revisions out of blame and can be enabled per project.

You should probably load your JavaScript with <script defer>

Loading JavaScript with defer avoids blocking rendering, runs after parsing, and still before DOMContentLoaded, making it the safer default for head scripts.

How to: Context-dependent word expansion in RubyMine

Context-dependent word completion in RubyMine speeds coding and reduces typos; Cyclic Expand Word can be remapped on German keyboards.

Disable PostgreSQL's Write-Ahead Log to speed up tests

Unlogged PostgreSQL tables can speed up Rails test suites by skipping the write-ahead log, but they raise crash-related data loss risk and stay unsuitable for production.

RSpec: be_true does not actually check if a value is true

be_true matches any truthy value, not only true; be_false likewise checks for falsiness. Use exact equality with == or eq when boolean values must be verified.

ActiveRecord: When aggregating nested children, always exclude children marked for destruction

Nested form deletions can inflate aggregated totals when child records marked for removal are still counted. marked_for_destruction? filters them out before saving.

open-next-failure: An alias to speed up test debugging

Open the next failing spec directly in the IDE to cut down the back-and-forth between test runs and debugging. RSpec --next-failure and JSON output support the workflow.

Capistrano 3: Running a command on all servers

Capistrano 3 can execute an arbitrary shell command across all app servers, useful for grepping logs or bulk remote checks.

Regular tasks for long-running projects

Long-running projects need regular upkeep to avoid stale dependencies, growing data, and bloated storage that raise costs and slow applications.

Summarizing heredoc in Ruby and Rails

Heredoc indentation and newline handling in Ruby and Rails varies by syntax and helper. <<~, strip_heredoc, and squish control unindentation and whitespace cleanup.

Databases don't order rows unless you tell them so

Database tables have no inherent row order; pagination with LIMIT needs a unique ORDER BY, and Rails first/last default to id.

Gitlab: How to cancel redundant pipelines

Redundant GitLab CI pipelines can waste runner capacity when new pushes arrive. interruptible: true and auto-cancel help stop outdated test runs and keep the latest commit building.

CSS has a built-in clearfix

Floated children can collapse their container, but display: flow-root creates a new block formatting context without clearfix hacks. IE11 lacks support.

Difference between respond_to/format and params[:format]

Non-HTML Rails responses can differ from params[:format]; respond_to also matches MIME negotiation, so authorization should not depend on a URL suffix alone.