undefined method assert_valid_keys in Rails

If you are getting an error about ‘undefined method assert_valid_keys’ in Rails : undefined method `assert_valid_keys' for :time_entry_product:Symbol … it may be because you have two relationships specified on the same line in your model : ...

February 24, 2009 · 1 min · Dave Perrett

Nginx adds strange characters using rails/memcached_pass

After upgrading a few gems recently, I found that the content returned from the nginx memcached_pass directive always had a few strange characters prepended. After some investigation it seems that this is caused by rails ‘marshalling’ the data. If you’re using a memcached set command such as Cache.set(key, content, time_to_live) You need to add an extra argument to force rails to cache the raw data instead of marshalling it : ...

December 23, 2008 · 1 min · Dave Perrett

Phusion Passenger PassengerMaxPoolSize is ignored

I’ve been wondering for a while why Phusion Passenger seems to completely ignore the PassengerMaxPoolSize, PassengerMaxInstancesPerApp and PassengerPoolIdleTime directives. I recently discovered that they don’t work inside VirtualHost blocks in apache config. The old (non-working) config was something like : ...

December 22, 2008 · 1 min · Dave Perrett

Pylons - LookupError: Entry point 'main' not found in egg

If you are getting a LookupError in Pylons similar to the following : ...

December 21, 2008 · 1 min · Dave Perrett

iTerm Delete Key Config

I’ve often found that after SSHing with iTerm, the delete key mappings are occasionally (well regularly) problematic. This post from Alaska Geeks sorted the problem out straight away in my case : ...

October 24, 2008 · 1 min · Dave Perrett

Simulate delayed-fade in jQuery

Unfortunately there is no .delay() function in jQuery. You can fake this, however, by using the .fadeTo() function: $("#my_element").fadeIn(1000).fadeTo(5000, 1).fadeOut(1000); ...

July 15, 2008 · 1 min · Dave Perrett

svn: Can't find a temporary directory: Internal error

If you’re getting a ‘svn: Can’t find a temporary directory: Internal error’ error while using subversion, check the disk space on the server : $ df You’re more than likely out of space. [dave@dev2:~/]$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/vg0-rootvol 73608360 73605908 0 100% /

July 14, 2008 · 1 min · Dave Perrett

Adding Appfuse Dependencies

I recently had trouble importing the com.sun.media.jai imaging library into appfuse : The import com.sun.media.jai cannot be resolved To add a dependency in your pom.xml, first add the new repository (may not be strictly necessary if the library is already in the default appfuse repositories) : ...

December 5, 2007 · 1 min · Dave Perrett

Complex Constants in Java

If you want to assign a complex class (such as a HashMap / ArrayList etc) as a constant in Java, use the static initializer block construct : ...

December 5, 2007 · 1 min · Dave Perrett

Default Values With Hibernate Annotations

To set the default value of a field with Hibernate, you can use the columnDefinition argument : ...

December 5, 2007 · 1 min · Dave Perrett