The most common use case for Ruby's #collect is to call a method on each list element and collect...
Given the problem you have a new column postion and that column should be updated for all existing rows with...
Generally for nested forms, a blank form is placed below all other existing object forms. If you would like to...
When adding a new field to your model's database table, don't set any defaults in the database.
In order to open a MySQL shell without the need to enter user and password, you can say the following...
In case you have sensitive data within your RDS instance, you want to use encrypted connections between your application and...
The technique described in this card has an important caveat: The result of GROUP_CONCAT is truncated to the maximum...
You can use heredoc to avoid endlessly long lines of code that nobody can read. Heredoc strings preserve linebreaks and...
When you run rake db:create and get this error message Couldn't create database for {"encoding"=>"utf8", "username"=>"root...
Most likely you run rake and your code is causing an exception which is not the one shown in your...
Here is a way to create a duplicate of one database, with all its tables and their data, under a...
You can use fold: fold -sw 60 You can now paste your texts. fold will echo them back, word-wrapped...
Observed on Rails 2.3 and machinist 1.0.6 Like the title says, when you define the method empty? like in the...
There is a bug in Rails 3's dbconsole script, which makes the following command open a database console for...
Remember how Rails 2 came with an awesome feature that broke all code using Time.now or Time.parse? This behavior is...
Simple: Tell the application controller how to handle exceptions, here a RecordNotFound error. Do this with the following line: # application_controller.rb...
jQuery as new default Javascript library, streaming response support, attr_accessible with roles, prepared statements, easier migrations.
I believe that when WEBrick has trouble bringing up your Rails application, the WEBrick component that is supposed to print...
While it might seem trivial to implement an invoice that sums up items and shows net, gross and vat totals...
Did you return false in a before_validation callback?
I recently browsed through the ActiveSupport code and found some nice stuff I did not know about: ActiveSupport::Callbacks
When the Ruby parser module of Ruby-GetText comes across a file in one of its search directories (e.g. lib/scripts...
Do you wonder which databases are actually taking up how much space but only have one huge ibdata1 in your...
If you use Amazon AWS cloud services you definitively want to utilize software raid for IO intensive stuff such as...