Categories
Rails

ActiveRecord::RecordNotSaved – before_save problem

I am in the middle of an update to my PeopleHub application and I started getting a weird error in my tests (yay for tests): ActiveRecord::RecordNotSaved

Part of the update was changing my before_save code to only do an expensive recalculation when it was required, and after doing so, setting the flag that it used to false (so that next time it didn’t do the expensive recalc). The code looked like this:

def before_save
  if self.do_update
    if x
      write_attribute("the_field", the_field_data)
      self.do_update = false
    elsif y
    end
  end
end

(please excuse the formatting. looks like my css needs attention)

So the end result of this is that in certain cases, the update is never done again. However, note that I am setting self.do_update = false at the end of the block. For those who remember their Ruby fundamentals (d’oh) they will know that if that line is the last that is evaluated in the block, it will return FALSE. As the docs say:

If a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled.

Whoops. Thanks to Rick Olsen (http://threebit.net/mail-archive/rails/msg38644.html) for the help

Categories
solaris zfs

Update Solaris SATA listing

I’ve updated my SATA page to show support for the VIA K8M800 chipsets.

Also, I found a good site for Solaris x86 on a Sun employee blog – James C. Liu’s Weblog

Categories
solaris zfs

Solaris SATA chipsets I can run ZSF with

After my last post, I set about finding out more info on SATA chipsets that I can use under Solaris. The main thing for me is that for some reason, I have drives fail fairly regularly. Maybe I am missing part of the necessary rituals to appease the gods of hardware, but the rotating rust that I have in my house really makes me paranoid about my data. Yes, I currently do offsite nightly backups over the internet, but that can’t keep EVERYTHING safe (I’m looking at you, Birdman).

Hence, ZFS. Now, I wanted to make a cheap, reliable, cheap data tank for my, err, data. I need a mobo that is supported by OpenSolaris, even down to the onboard SATA controllers (not so much for sound, however). Initially, all the info pointed to a Nforce chipset, and that would have been fine. Unfortunately at the moment I can’t seem to find a single cheap AM2 CPU in Brisbane, which I need to have because the old CPUs don’t have the new funky chipsets. The cheapest mobos were all VIA chipset jobbies and unsupported by Solaris for the SATA. Or so I thought. But being the good noodle that I am, I just checked that before writing it off again – after all I had found out reccently that Sil 3114 chipsets were OK, so wrong once, wrong more than once perhaps?

Anyway, here’s my findings – Solaris SATA support for onboard chipsets. Turns out all those cheap VIA boards like the ASUS K8V-X SE are just fine, and teamed with a 4-port Sil 3114 PCI card, I’ll be laughing (I would prefer one of the Micro-ATX variants of these boards but they use the K8M800 chipset for which I can find absolutely no information one way or another… logic dictates that it shouldn’t matter, but the “K8T800” is fine and the “K8T800 Pro” is not so it ain’t necessarily so). If I am wrong in any of this, please correct me, but as with everything on the interwebs, check it yourself first, and DON’T BLAME ME if it doesn’t work. No warranty, YMMV, etc.

Looks like the K8V-X SE motherboard has a Realtek 8201CL ethernet chipset, and I can’t find any drivers, even on this compendium of solaris network drivers. Don’t mind though, I’ve got oooh, 3 PCI cards lying about unused… mostly Realtek 8129 / 8139 chipset so I’m laughing. Turns out I also have 4 sound cards (including 2 SB Live). What the hell am I going to do with 4 sound cards?