Since we are using LoDash instead of UnderscoreJS in recent/current projects, you should keep in mind that their syntax is...
Creating records in specs can be so fast that two records created instantly after one another might have the same...
Returning an empty scope can come in handy, e.g. as a default object. In Rails 4 you can achieve this...
We upgraded a Rails 2 application to Rails 3.2 and Ruby 2.1, changed the mysql adapter from mysql to mysql2...
p ActiveRecord::Base.connection.indexes(:table_name)
This may be hard to find in the docs, but if you want CoffeeScript classes that instantiate their properties from...
class Document < ActiveRecord::Base scope :any_tags, -> (tags){ where('tags && ARRAY[?]', tags) } scope :all_tags, -> (tags){ where('tags @> ARRAY...
tl;dr: Use with_index ActiveRecord's find_each with index If you do not provide a block to find...
To avoid n+1 queries, you want to eager-load associated records if you know you need to access them...
Use reorder to replace an existing order clause with a new expression.
If you get an error like this: An error occurred while installing pg (0.17.1), and Bundler cannot continue.
It's like Paperclip or CarrierWave, but without any automagic integration.
Sometimes you need complex expectations on method arguments like this SomeApi.should_receive(:find).with(:query => '*foo*', :sort => 'timestamp ASC', :limit...
PDFKit converts a web page to a PDF document. It uses a Webkit engine under the hood...
When using jQueryUI's Sortable plugin (either directly or via Angular's ui.sortable), you might struggle testing your nice drag...
Yesterday, Rails fixed a security issue (CVE-2014-3514) in Rails 4+. It was possible to use .where...
Nearly all jQuery traversal functions ignore elements that are not HTML tags. To work with other type of nodes (like...
require 'net/http' module Cheat extend self # the magic ingredient def host @host ||= 'http://cheat.errtheblog.com/' end def http @http ||= Net...
edge_rider is Power tools for ActiveRecord relations (scopes). Please note that some of the functions edge_rider provides have...
When you have an Angular directive that transcludes content, you might want to do something in case there is no...
Directly from the MySql docs: There are three likely causes for this error message. Usually it indicates network connectivity trouble...
TL;DR In blueprints, always wrap associations in blocks. # Broken Task.blueprint(:vacation) do project Project.make(:vacation) hours 8 accounting_method...
Open a MySQL root shell and use this command: PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0...
When making cross-domain AJAX requests with jQuery (using CORS or xdomain or similar), you will run into issues with...