Back to Normal

Sunday, January 13, 2013

I think I have all the bugs fixed.

For anyone who's wondering, this was all caused by a forced upgrade. I don't upgrade the site often, so it's usually running on older versions of the software. But there was a big scary exploit that had been published, so I was forced to upgrade to Rails 2.3.15.

With that upgrade came a bunch of other changes, and it introduced some incompatibilities in pre-existing code. The last one involved the player game history. Probably none of the Second Life players care about this (except that it's been fixed), but I'll document it here for the benefit of any Rails coders confused as to why their named scopes are no longer working.

To generate the player history, I have a named scope which looks something like this:

named_scope :played_by, lambda { |*avs| { 
      :select => "games.*", 
      :joins => [:plays => [:avatar] ], 
      :conditions => {:plays => { :avatars => {:id => avs} } }

So I could pull up games played by two player like Games.played_by(mark, john). And that worked fine under Rails 2.3.5. But when I updated to Rails 2.3.15, the same code was giving me ActiveRecord::StatementInvalid.

I didn't get an error message more explicit than that, though. So I had to browse through the Rails code to find out more. It looks like sometime between 2.3.5 and 2.3.15 they changed sanitize_sql_hash so that it no longer accepts nested hases. I don't know why they changed that; it was working fine before. But I had to change my named scope to flatten out the nested hash, like this:

named_scope :played_by, lambda { |*avs| { 
      :select => "games.*", 
      :joins => [:plays => [:avatar] ], 
      :conditions => [" in (?)", avs] }

And now it works again.

Customer page

Saturday, January 12, 2013

It looks like something on the customer page didn't survive the upgrade. I'm looking into it -- please be patient, it's just me and I don't have a lot of time to fix things like this.

EDIT: 7:23PM SLT The Customer page is mostly back up. If you get an error when trying to connect, clear your cookies (or just your procyon games cookie). The versus listing is still not working -- you can't get a list of all games you've played against someone recently. Hope to have that working tomorrow.

Server issues

Thursday, January 10, 2013

I attempted to upgrade the server this morning, but something went wrong and I can't roll it back. I'm working on getting it back up, until then all server-related functionality is down. No ETA yet on when it will be working again, sorry.

EDIT: I think it's back up now. If you notice problems let me know.