Unfreeze a frozen ActiveRecord
Frozen ActiveRecord instances raise can't modify frozen hash when attributes change; dup usually creates an unfrozen shallow copy, though Rails 2.3.x has a bug.
Add a prefix to form field IDs
Rails form fields can clash when the same form is rendered multiple times; a prefix keeps field IDs unique without changing submitted names.
How to test bundled applications using Aruba and Cucumber
Bundler environment variables can shadow a Rails test app when integration-testing CLI tools with Aruba and Cucumber. Clearing the Bundler env and disabling Spring keeps commands isolated.
Virtual attributes for date fields
Virtual date attributes in forms arrive as strings, so Rails does not auto-cast them like database columns. A custom accessor can coerce them to Date objects or nil.
Virtual attributes for integer fields
Virtual integer attributes in Rails can lose form selections and type casting on validation roundtrips; an auto-coerced accessor keeps values as integers or nil.
Re-enable submit buttons disabled by the :disable_with option
Rails submit buttons with :disable_with can stay disabled after back navigation, leaving forms unusable until they are re-enabled on page unload.
Fix "couldn't parse YAML" error after upgrading Bundler
Rails can fail to boot after a Bundler upgrade when the new YAML engine cannot handle symbol values in localization files.
Rack dies when parsing large forms
Rack can reject large nested forms by miscounting input fields against its parameter limit, causing low-level Ruby errors or Rails error pages.
Rails 3 issue: update_all ignores conditions, when :orders and :limit options are supplied
update_all can ignore conditions when :order and :limit are present, causing unintended bulk updates in Rails 3.
Introducing GoodJob 1.0, a new Postgres-based, multithreaded, ActiveJob backend for Ruby on Rails
Background job processing for Rails can avoid Redis infrastructure and managed Redis costs while staying compatible with ActiveJob through a Postgres-backed worker gem.
Use Memoizer instead of ActiveSupport::Memoizable
ActiveSupport::Memoizable is being removed and has awkward edge cases; Memoizer provides straightforward method caching across Rails versions.
Capybara 2.0 has been released
Capybara 2.0 breaks compatibility with 1.x and drops Ruby 1.8 support. It changes Rails integration test conventions, element matching, and RSpec syntax.
How to render an html_safe string escaped
Rails treats html_safe strings as already escaped, which can block escaping when safe HTML must be passed through JSON or shown as text. Converting to a plain String restores escaping.
Run specific version of bundler
Run an older Bundler release for compatibility when Rails or another project is pinned to a specific gem version.
Marry Capybara with SSL-enabled applications
Capybara can lose the HTTPS state when specs cross between secure and insecure Rails actions, causing request URLs to fall back to the wrong protocol.
Split an array into columns
Distributing array items into visual columns is awkward with in_groups and in_groups_of; in_columns returns wrapped column arrays in pure Ruby and Rails.
How to generate a Rails-compatible query string
Rails hashes can be turned into URL query strings with Hash#to_query; browser-side nested objects can be serialized with jQuery $.param.
include_tags with the asset pipeline
Rails asset paths depend on a leading slash when using javascript_include_tag or stylesheet_link_tag; files in /assets also need to be added to the precompile list.
HTML5: Allow to choose multiple files with a vanilla file picker
Native file inputs can accept several uploads at once with multiple, but server parsing usually needs array-style names and custom Rails adaptation.
Pimp my IRB
Custom .irbrc files can make irb and the Rails console more useful with extra methods, nicer printing, editor integration, and app-specific prompts.
simple_format helper for Javascript
Rough JavaScript equivalent of Rails simple_format for turning plain text into HTML paragraphs and line breaks. Whitespace preservation is not included.
Fix Capistrano warnings: Missing public directories
Capistrano deployment warnings can appear when Rails asset pipeline apps lack empty public subdirectories. Placeholder files like .gitkeep suppress the missing-path errors.
Rails 3 ActiveRecord::Persistence#becomes does not copy changed attributes
ActiveRecord::Base#becomes leaves changed attribute tracking inconsistent, which can break attribute_was checks after casting models with defaults. ActiveType.cast is often the safer alternative.
Useful Ruby Pathname method
Ruby Pathname objects can build file paths with :/ or join, making path concatenation in Rails more concise and readable.