acts_as_taggable_on: Match records tagged with all, any or none of the given tags

Filter tagged records by all, any, none, or owner-specific tags with tagged_with options for flexible tag-based queries.

Do not try to "slice" on an ActionController::CookieJar

ActionController::CookieJar looks like a Hash, but slice fails when selecting cookie subsets because Hash#slice instantiates the wrong class.

Convert Haml to ERB

Haml markup can be migrated to ERB with haml2erb, but the conversion is only partly automated and still needs manual cleanup.

Use the same translations for ActiveRecord and ActiveModel

Duplicate model, attribute, and error translations for ActiveRecord and ActiveModel by reusing YAML anchors and aliases instead of maintaining separate locale entries.

RSpec 3 no longer chooses a spec's type based on its directory

RSpec 3 no longer infers spec type from folder names, which can break helpers like routing in existing suites. Set type explicitly or re-enable file-location inference.

Don't call gsub on safe strings

Calling gsub on html_safe strings can break backreferences like $1 and leave matches unusable. html_safe strings need special handling after substitution.

Sass partial names must always start with an underscore

Imported Sass files need a leading underscore or they compile into standalone CSS and can fail when they depend on shared variables or mixins.

ActiveRecord: Order a scope by descending value without writing SQL

Image.order(created_at: :desc) sorts records descending without raw SQL and automatically qualifies column names; multiple order criteria fit in a hash.

Asset pipeline: Precompile non-standard manifests

Non-standard asset manifests are not precompiled by default, so custom config.assets.precompile entries are needed for additional CSS and JS bundles.

howto fix spreewald issue „database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)“

Spreewald fails with ActiveRecord::AdapterNotSpecified when database.yml defines Cucumber settings instead of test settings. Renaming the environment entry to test resolves the adapter error.

stefankroes's ancestry at master - GitHub

Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a tree structure (or hierarchy). It uses a single, intuitively formatted database column, using a variation on the materialised path pattern. It exposes all the standard tree structure relations (ancestors, parent, root, children, siblings, descendants) and all of them can be fetched in a single sql query. Additional features are STI support, named_scopes, depth caching, depth constraints, easy migration from older plugins/gems, integrit...

7 Ways to Decompose Fat ActiveRecord Models - Code Climate Blog

Fat ActiveRecord classes accumulate business logic over time, creating maintenance problems and callback hell in large apps. SRP keeps persistence objects focused and easier to change.

We forked craken

Newer rake versions can break craken:install with a "can't convert Hash into String" error during deployments.

Haml: Fix problem with HTML-escaped single quotes in text fields

Haml 3.1.2 can double-escape single quotes in FormBuilder#text_field values, producing David's Chapter; upgrading to 3.1.5 or newer fixes it.

Mysql/Mysql2 agnostic database.yml

Upgrading to the mysql2 gem can require a deploy-time database.yml change; one adapter line can keep the same config working with both MySQL libraries.

How to fix: "500 Internal Server Error" after adding Rack::Bug

Passenger and Apache can return 500 errors after adding Rack::Bug when the middleware is referenced as a string instead of loaded with require 'rack/bug'.

Getting Sidekiq error "delay is defined by Active Record"

Active Record can conflict with Sidekiq's delay method when a model has a delay attribute. Sidekiq.remove_delay! disables it; Sidekiq.hook_rails! keeps Sidekiq methods prefixed.

Why your all.js is empty on staging or production

When you include a non-existing Javascript file, you probably won't notice it during development. But with caching active (on production or staging) Rails will write an empty all.js file without complaining.

url_for with added params

url_for accepts only one argument, so extra query parameters fail. polymorphic_url builds the same link and keeps additional params.

Solve ActiveRecord::MissingAttributeError "missing attribute: foo"

ActiveRecord::MissingAttributeError appears when a query omits a column later accessed on the model, often after using select with too few fields.

Chartkick

Create JavaScript charts from Ruby with a single line while keeping data local instead of sending it to Google.

patbenatar/jquery-nested_attributes

jQuery plugin for dynamically adding and removing ActiveRecord nested records in forms, simplifying repeated input for parent-child data.

Evening on Backbone.js/Views w/ Q&A with David Heinemeier Hansson - YouTube

Basecamp stays fast with little JavaScript by combining server-rendered pages, PJAX, and Russian doll caching to reduce client-side work.

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.