blog.bigbinary.com

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...

makandra dev
rakeroutes.com

Put the attached files into your home directory and enjoy. .irbrc defines interesting_methods, which is essentially all methods without...

makandra dev

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

railway.at

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...

stackoverflow.com

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...

mysqlperformanceblog.com

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...

makandra dev

Do this before you install the gem: sudo apt-get install libffi-dev

When you have a Pull Request on GitHub that includes commits from another Pull Request, you will still see them...

Mark window as "demands attention" Install wmctrl through your package manager, i.e. sudo apt-get install wmctrl Download the attached...