Carl Coryell-Martin's blog



Carl Coryell-MartinCarl Coryell-Martin
SF Standup Feb 26, 2010: Golden Gate Ruby Conf Dates!
edit Posted by Carl Coryell-Martin on Friday February 26, 2010 at 09:21AM

Asking for Help

"Reloading model associations in Rails doesn't do what you expect it to do."

If you have a has_one relationship between the parent and the child and you reload the association, rails 2.3.2 will do a 'select * limit 1;' from the child table which is not what you want.

"How do I get the debugger in RubyMine to load my fixtures?"

So apparently the debugger built into ruby mine is using a different database connection that doesn't see the fixtures. Probably because they are built in an uncommitted transaction. The command line debugger doesn't have this problem.

Interesting Things

Carl Coryell-MartinCarl Coryell-Martin
SF Standup Feb 24, 2010: Chasing Down Obscure Error Messages
edit Posted by Carl Coryell-Martin on Wednesday February 24, 2010 at 09:34AM

Interesting Things Today

  • Message "undefined method 'join'" on gem installation during deployment to Engine Yard turned out to be the result of an upgrade of RubyGems from 1.3.5 to 1.3.6. The new version no longer requires stringio which broke bundler 0.8.1. The solution was to install the gem bundler08 -v0.8.4 on the server and then rerun 'gem bundle.'

  • A mysql 'Error 139' was traced to a mysql 5.0 innodb table that had enough varchar(255) and text columns such that the total bytes in the row exceeded 8k bytes. This is allegedly fixed in 6.0 (maybe 5.1).

  • Finally a team noticed the new 'touch' option in rails 2.3.4 on has_many and belongs_to attribute that allows you to update the updated_at attribute of child and parent objects. They'd implemented their own observer pattern to do the same thing but this was much easier.

Carl Coryell-MartinCarl Coryell-Martin
SF Standup Feb 23, 2010: Bleeding edges break things
edit Posted by Carl Coryell-Martin on Tuesday February 23, 2010 at 09:50AM

Interesting Things

  • One project attempted upgrading the newrelic rpm to version 2.10.3 and 2.10.4 but it broke delayed_job. The fix was to down grade newrelic to version 2.9.9.

  • Ruby versions above 1.8.7 patch level 174 are not stable with RVM. Incidentally this is the version of ruby that ships with snow leopard.

One Question:

  • What's the best practice for configuring services that notify users between development, staging and production? You really don't want to send out a million email notifications by mistake when you are testing the staging version of a service. If you put the switch in the database, it could lead to the production database being moved to staging or development and sending out erroneous notifications. Putting the switch in an environment variable means that it's difficult to test the staging server with some sample data.

Some Answers:

  • Some projects encrypt credentials for the different environments with different keys, thus the production credentials will absolutely not be available to the staging servers. (This can be hassle because you get exceptions when you try to use the real credentials in a staging environment with the different key.) Doing this means that you can inject test data into the staging environment encrypted with the staging keys and use that without risk of mistakenly sending notifications to real users.

  • Consider wrapping the API in question with a fake that only talks to the real world in the production environment.

  • Perhaps you could set up a rake task that manages the state of a live versus test notification.