I just experienced this issue with an old Rails 3.0.10 application, where associations wouldn’t work properly. Apparently if config.cache_classes = false is true (which is default in the production environment) Rails is only evaluating associations once.
After 24 hours the new competitions would not show up, unless if we restarted our application servers.
This got me confused for a while, but I was able to replicate it. I set config.cache_classes = true and loaded up the Rails console, and did this:
1.8.7 :001 > Site.find_by_name(‘example.dk’).competitions SELECT “competition”.* FROM “competition” WHERE (“competition”.site = 54 AND (startdate <= ’2012-12-10 10:33:09 +0100′ AND enddate > ’2012-12-10 10:33:09 +0100′)) ORDER BY startdate DESC
And running it again 2 minutes after:
1.8.7 :002 > Site.find_by_name(‘example.dk’).competitions SELECT “competition”.* FROM “competition” WHERE (“competition”.site = 54 AND (startdate <= ’2012-12-10 10:33:09 +0100′ AND enddate > ’2012-12-10 10:33:09 +0100′)) ORDER BY startdate DESC
Notice that the dates are exactly the same.
My fix was to use scopes for this behavior and not clauses. Some blogs suggests that it helps to use interpolation, but that is not my experience.
I got tired of seeing LC_ALL and other locale specific errors on my Ubuntu installs on Linode (and other vservers). Apparantly all you need to do is this:
1. Run this: apt-get install language-pack-da-base
I recently needed to check the date across all of our servers, so instead of SSHing into all of them and executing a command manually, I learned about the tool pssh.
But to see the output of the server you need to use the -i argument:
[~]=> pssh -h benjamin-servers -i "date"
[1] 13:34:11 [SUCCESS] backend@server1.dk
Tue Jun 12 13:34:11 CEST 2012
[2] 13:34:11 [SUCCESS] backend@server2.dk
Tue Jun 12 13:34:11 CEST 2012
[3] 13:34:11 [SUCCESS] backend@server3.dk
Tue Jun 12 13:34:11 CEST 2012
[4] 13:34:11 [SUCCESS] backend@server4.dk
Tue Jun 12 13:34:11 CEST 2012
[5] 13:34:11 [SUCCESS] backend@server5.dk
Tue Jun 12 13:34:11 CEST 2012
[6] 13:34:11 [SUCCESS] backend@server6.dk
Tue Jun 12 13:34:11 CEST 2012
[7] 13:34:11 [SUCCESS] backend@server7.dk
Tue Jun 12 13:34:11 CEST 2012
If you are unfortunate enough to run a couple of servers, without having a centralized keystore, or manage the server with puppet, you can add a public key to multiple servers with pssh as well:
I had a very fun week, and now I am powering up for the next one! The title of this blogpost was originally called ‘Low-key sunday’ as a tribute to ‘Beskidte Toner’, with a lot of chill tunes. But then I realized that I had too much energy for listening to slow music
My suggestions for getting ready for the dreadful monday we all hate:
The Glitch Mob – Beyond Monday
Madeon – Pop Culture
Pretty Lights – Looking For Love (But Not So Sure)