When you have a hook in your Capistrano file that dumps your remote database, you might not want it to...
Copy the attached Ruby code to config/initializers, or paste it into your IRB console. You can now dump any two...
Put the attached file into config/initializers/ to be able to say created_within on any ActiveRecord or its scope chain...
When your cucumber features grow massively over time, the test execution can take a lot of time.
Soon after having written our shell-for script, we wanted to easily get dumps of our productions machines, too. This...
After having written useful scripts into makandra notes for a long time, we’ve now tied them into a powerful...
If you want to play music or sounds from a browser, your choice is to use either Flash or the...
Ruby comes with a class BigDecimal which you can use for arbitrary precision arithmetic. You should use BigDecimal instead of...
When storing floating-point numbers such as prices or totals in an SQL database, always use a DECIMAL column. Never...
When deploying an application with "cap deploy" by default [1] you only deploy your code but do not run migrations...
User Stories should describe what a user wants the system to do. Purely technical tasks should usually be implemented as...
ActiveRecord gives you the :include option to load records and their associations in a fixed number of queries. This is...
User.active.to_sql Rails 2 Use either the Edge Rider or fake_arel gem to get #to_sql backported...
Note: ActiveRecord::Base#becomes has a lot of quirks and inconsistent behavior. You probably want to use ActiveType.cast instead.
When using ActionMailer, you can set an array of email addresses as recipients. If this array is generated by e.g...
The attached RSpec matcher exist_in_database checks if a given record still exists in the database and has not...
When you need to insert many records into the same table, performance may become an issue. What you can do...
You will occasionally need to clean out your database while keeping the schema intact, e.g. when someone inserted data in...
MySQL's MIN and MAX functions are for aggregations only. This will not work and produce an error:
Currently, only up to 500 rows of Analytics table data can be exported at a time into CSV format. If...
Although you can access many symbols using the AltGr key you may be missing some, like the en-dash (–) or...
Note: For PostgreSQL you should use advisory locks. For MySQL we still recommend the solution in this card.
This note is a reminder that there is something called AppArmor that could cause weird errors ("File not found", "Can...
On 32bit systems, the maximum representable Time is 2038-01-19 03:14:07 in UTC or 2038-01-19...