Rails 3: Mass assignment protection and .create_with
create_with and where can bypass Rails 3 mass-assignment protection, allowing protected attributes to be set from untrusted input.
Set default_url_options for entire Rails application
Set application-wide defaults for URL generation in Rails instead of duplicating them in multiple places as issues arise.
Ruby and Rails deprecation warnings and how to fix them
Ruby and Rails deprecations can hide runtime problems and break future upgrades. Typical fixes involve updating gems, replacing obsolete API calls, or adding compatibility shims.
How to fix: Rails query logs always show lib/active_record/log_subscriber.rb as source
Rails verbose query logs can point every SQL query to lib/active_record/log_subscriber.rb when backtrace silencers are disabled, making sources unhelpful.
How to upgrade Cucumber on Rails 3+
Updating Cucumber on Rails 3+ requires refreshing cucumber, capybara, and cucumber-rails, then restoring any custom support setup after installation.
MySQL: How to create columns like "bigint" or "longtext" in Rails migrations, and what :limit means for column migrations
Rails migration column sizes depend on type: :limit controls bytes or characters, and certain values map to MySQL tinyint, smallint, mediumint, bigint, text, mediumtext, or longtext.
Sharing cookies across subdomains with Rails 3
Cross-subdomain session cookies in Rails 3 need a shared cookie domain; local development can fail with CSRF token errors when browsers reject the cookie.
Comparing Rails' flash hashes will not respect their internal lists of used entries
Rails FlashHash comparisons ignore the internal used-entry state, so two flashes can look equal even when their next-request behavior differs.
Speed up file downloads with Rails, Apache and X-Sendfile
Rails can hand file delivery to Apache with X-Sendfile, reducing application-server load and preventing zero-byte downloads when local files are sent.
Spreewald 4.3.3 released
Built-in support for Rails and Bootstrap error classes reduces step overrides, while configurable error classes, XPath selectors, and optional negation improve flexibility.
How Rails and MySQL are handling time zones
Rails and MySQL handle datetimes differently: local-zone storage can avoid conversions, while UTC mode supports per-request zones but requires Time.current and careful timestamp handling.
Rails: Concurrent requests in development and tests
Puma concurrency in Rails depends on workers and threads; self-calls during a request can deadlock in development or tests unless multiple workers are enabled.
Run a script on the server
Set the Rails environment explicitly when running server-side scripts to avoid using the wrong database or configuration. Rails 2 uses script/runner; Rails 3 uses rails runner.
Rails - Multi Language with Fast_Gettext
Rails localization with fast_gettext enables multi-language apps using .po files, _() and n_() for translated text and plural forms.
HTML emails with inline stylesheets and webpacker
HTML emails often break when mail clients ignore external stylesheets. premailer-rails inlines CSS for Rails mailers, and inline image attachments improve compatibility.
Fix warning "already initialized constant Mocha" with Rails 3.2
Version mismatches between Mocha and Rails 3.2 can trigger an already initialized constant warning; updating Mocha and using a matching Rails version avoids it.
Test a gem in multiple versions of Rails
Rails gems that must support several framework releases need separate test apps per version. Shared code and specs reduce duplication while keeping version-specific coverage.
Safely chain scopes with hash conditions
Rails 2 and some Rails 3.x versions let chained scopes overwrite hash conditions on the same attribute, creating authorization leaks. chain_safely avoids that overwrite.
Rails: How to list all validations on a model or an attribute
Inherited models and concerns can hide which checks run on a Rails model; validators and validators_on reveal them at runtime.
Plotting graphs in Ruby with Gruff
Ruby charting library for Rails that generates PNG graphs with themes, multiple series, and automatic sizing for large datasets.
Render a view from a model in Rails
Render Rails views outside a request for PDFs, email attachments, or background reports using ApplicationController.render or render_to_string.
Rails: wrap_parameters for your API
Rails can nest flat JSON request bodies under a root key so strong parameters work like form submissions and stray keys such as format stop interfering.
How to debug Rails autoloading
Rails constant loading can fail silently in development, especially with threaded code. Logging ActiveSupport::Dependencies helps trace autoloader behavior and diagnose hangs.
Use different code for Rails 2 and Rails 3
Reusable Ruby code can need different behavior across Rails 2 and Rails 3+. Version checks let code branch cleanly for compatibility.