Next time you have to do more than trivial CSS changes on a project, you probably want to have live...
Set the hash to a dummy hash which doesn't hit any id at your page, for example: window.location.hash = "_";
Remember why preloading associations "randomly" uses joined tables or multiple queries? If you don't like the cleverness of this...
1. Saving files to a directory that is not shared between deploys or servers If you save your uploads to...
Active Record's select method allows you to make use of the power of MySQL select statements. On the one...
The Rails secret_token must be unique for each application and any instance of it. If not, someone could exploit...
Put the attached files into your home directory and enjoy. .irbrc defines interesting_methods, which is essentially all methods without...
Sometimes sound breaks for me and speaker output is completely broken. This helped: pulseaudio -k && sudo alsa force-reload
No chance you would have ever guessed it... sudo palimpsest
Note: These instructions are for a quick per-project setup and may require you to change code. If you generally...
Authentication is hard: there are many edge cases, and most users (including yourself) usually only go the "happy path" once...
We have often felt the pain where our models need to serve too many masters. E.g. we are adding a...
Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...
Caution when using .where to exclude records from a scope like this: # Fragile - avoid User.where("id NOT IN (?)", excluded_ids...
This only works when you actually have a session ID (not the case for Rails' CookieStore, for example): request.session_options...
Usually, the logrotate service takes care of renaming log files each night or so to avoid logs becoming huge. That...
Since there are more and more touch-capable devices out there, as a web-developer it becomes more and more...
Consider this class: class Foo private def test puts "Hello" end end While you can say create a block to...
Here is a hacky way to load dumps directly from the source server, without fully copying them over and extracting...
When MySQL refuses to use your index, there's a number of things that you may be doing wrong. One...
If you need to capture signatures on an IPad or similar device, you can use Thomas J Bradley's excellent...
When creating an ActiveRecord with .new, .create or create!, you cannot set the ID attribute (note: When using Machinist's...
Mobile browser's ignore the autoplay attribute on and elements. Stupid reasons include saving mobile bandwidth on behalf of the...
Do this before you install the gem: sudo apt-get install libffi-dev