Modifying Rake Tasks - Dan Manges's Blog
Custom Rake tasks are meant to stay unchanged, but vendor tasks such as Rails task definitions can be extended with additional behavior.
assignable_values 0.4.1 adds secondary default values
assignable_values can now fall back to a secondary default when the primary default is not assignable, helping authorization rules avoid invalid records for restricted users.
Remove the module namespace of a qualified Ruby class name
String#demodulize from ActiveSupport strips module namespaces from qualified Ruby class names, leaving only the last constant name.
Gem development: When your specs don't see dependencies from your Gemfile
Bundler does not auto-require gems, so specs may miss dependencies unless the environment calls Bundler.require; direct dependencies still must be required by the gem itself.
Consul 0.4.0 released
Consul 0.4.0 adds temporary power switching, support for Ruby collections and arbitrary objects as powers, and drops the ActiveSupport::Memoizable dependency.
Market share of web browsers
Browser usage on a site varies by audience and region; tracking tools provide broader traffic statistics when visitor data is unknown.
Check if an object is an ActiveRecord scope
Checking for an ActiveRecord scope with is_a?(ActiveRecord::NamedScope::Scope) breaks in Rails 3 and misses unscoped model classes. respond_to?(:scoped) is a broader check.
Use the "paper_trail" gem to track versions of records
Version history for Active Record records with paper_trail, including previous values, change diffs, and the user who made each update.
Updated: Remove quotes from Sass mixin arguments
Sass mixin arguments sometimes need unquote to pass raw values instead of quoted strings, especially when generating usable CSS.
Updated: assignable_values can now humanize any given value, even if it's not the current attribute
assignable_values now humanizes any supplied value, not only the current attribute value, making alternate labels available for display and lookup.
How to change will_paginate's "per_page" in Cucumber features
Pagination tests in Cucumber often need fewer records than the default will_paginate page size. Stubbing per_page per model keeps feature scenarios small.
Maximum size of a MySQL query
MySQL query size is limited by max_allowed_packet; the default is 16 MB, so oversized requests can fail unless the server setting is increased.
Using the Rake Build Language
Rake tasks can gain dependencies after initial declaration, making task relationships easier to extend and keep near prerequisite definitions.
When Date.today and Date.tomorrow return the same day...
Date.today and Date.tomorrow can return the same day when Rails has no configured time zone, causing date handling to drift between UTC and local time.
When connecting to a second database, take care not to overwrite existing connections
Opening a second ActiveRecord database connection can silently disconnect an unfinished transaction. Use a separate abstract class to keep the original connection intact.
MySQL operator precedence
Multiple AND and OR conditions can change query results unexpectedly; parentheses make the intended logic explicit and prevent precedence bugs.
Asset pipeline for Rails 2
Rails 2.3 can use the Rails 3.1 asset pipeline through a backport for managing and serving static assets.
Request limit of graph.facebook.com
Facebook API access is limited to 600 requests per 600 seconds; polling more often can return empty or malformed responses.
PhoneGap Build
Cloud compilation turns web apps into app-store ready builds for iOS, Android, Windows Phone, BlackBerry and more without changing your HTML, CSS or JavaScript workflow.
Drag'n'drop in trees: I went to town
Nested drag-and-drop for reorderable trees is hard when items can be leaves or containers; precise drop targets need custom JavaScript, CSS, and testing support.
Nice way to set data attributes when creating elements with Rails helpers
link_to and content_tag accept a :data hash for HTML5 data attributes in Rails 3, simplifying data-foo and data-bam output.
How to enable MySQL query logging
MySQL can record every received query for debugging at the cost of performance. Enabling the general query log helps inspect database activity on non-production systems.
jQuery.cssHooks – jQuery API
Custom $.cssHooks normalize browser-specific CSS properties and extend .css() and .animate() handling for inconsistent style values.