ActiveRecord: scoped `validates_uniqueness_of` allows one null value per scope

Scoped validates_uniqueness_of can let one nil value through per scope, creating unexpected records when presence is not enforced.

How to deal with 'parent id missing' error in nested forms

Nested forms can fail with a “parent id missing” validation when parent and child records are created together; using form models or validating parent instead of parent_id avoids it.

How to silence thin boot messages

Thin prints startup messages that clutter parallel test output. Logging can be silenced with Thin::Logging.silent = true or redirected to a custom logger.

Long cards: Directly jump from a paragraph to the same paragraph in the editor

EDIT links on card paragraphs open the editor at the same paragraph and place the caret there, making small changes in long cards faster.

How to split config/routes.rb in Rails 4

Splitting Rails route definitions across multiple files can improve organization in larger apps. Rails::Engine and config.paths['config/routes.rb'] can load route files from config/routes/.

marco-polo improves your Rails console prompt

Displays the app name and Rails environment in the console prompt, reducing the risk of running commands in production by mistake.

Get the root class of an ActiveRecord STI hierarchy

base_class returns the top ActiveRecord STI class by walking up inheritance until an abstract class or ActiveRecord::Base is reached.

How to enable SSL in development with Passenger standalone

Local Rails development can serve both HTTP and HTTPS with Passenger standalone by enabling SSL and using a self-signed certificate.

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.

Bootswatch: Paper

Free Bootstrap theme with a Material Design look for Rails apps. Sass and Less files simplify integration, while the CSS-only approach keeps the theme easy to replace.

List of Helpful RubyMine Shortcuts

RubyMine keyboard shortcuts speed navigation, multi-caret editing, refactoring, and file handling for everyday Ruby development tasks.

PostgreSQL: Be careful when creating records with specific ids

Manually assigning primary keys in PostgreSQL can leave sequences unchanged, causing duplicate-key errors on the next insert. Resetting the sequence prevents conflicts.

Non-blocking Asynchronous JSON.parse Using The Fetch API

Offloading expensive JSON.parse work from the main thread keeps fetch-based apps responsive and avoids blocking during large response processing.

Openstack: nova resize

Changing an OpenStack VM’s RAM, disk, or vCPU count requires nova resize and a matching flavor; the resize causes downtime and can take a long time.

Jasmine: Testing complex types for equality

toBe only checks reference identity; toEqual handles arrays, objects, dates, regular expressions, NaN, exceptions, and custom equality testers.

Mocking time in Jasmine specs

Control time in Jasmine tests with the built-in jasmine.clock() to fake timers and new Date() without adding SinonJS.

Pierce through Javascript closures and access private symbols

Accessing state hidden in JavaScript closures can simplify tests and let Jasmine spies mock private methods or inspect local variables.

Detecting N+1 queries with Bullet

Bullet monitors database queries during development and flags N+1s, unnecessary eager loading, and missing counter caches to improve application performance.

Rails 4.2 Foreign Key Support

Database constraints for comments and users help enforce referential integrity, but support is limited to certain adapters and can surface ActiveRecord::InvalidForeignKey errors.

Spreewald 1.2.11 fixes frequent "no alert open" errors on Chrome

Chrome updates can cause frequent no alert open errors in Capybara dialog tests. Spreewald 1.2.11 waits for browser dialogs before confirming them.

How to fix a corrupt (zsh) history file

Corrupted zsh history files trigger startup errors and can be rebuilt by extracting valid entries from the damaged history data.

Capistrano 3 has slightly changed its symlink implementation

Capistrano 3 symlinks linked directories using the full path, so public/system now points to shared/public/system instead of shared/system.

JavaScript events: target vs currentTarget

event.target points to the clicked descendant, while event.currentTarget points to the element handling the listener; currentTarget is usually the safer choice.

A commitment is not a guarantee - Pivotal Tracker

Teams can commit to quality software, but cannot guarantee outcomes they do not fully control.