Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
NYC Standup – February 27th, 2012

Interesting

Monit + ‘check program’ + Zombies

from Dave Goddard

Monit recently introduced a new type of service to check ; “check program” which will run a script each cycle (or specified number) and will end up being good or bad depending on the exit code. After we started using this, we noticed that the script was often marked as a zombie on the machine ; at first we blamed the script, but eventually discovered that this is expected behaviour by monit, and that monit is planning to fix it RSN (real soon now)

Polymorphic Associations and Active Record Subclasses

from Adam Milligan

If you have a polymorphic association, Rails will use the base class of the parent of the association (as defined by ActiveRecord) as the class name of the associated parent.

For instance:

class Foo < AR::Base
  belongs_to :wibble, polymorphic: true
end

class Bar < AR::Base
  has_many :foo, as: :wibble
end

class Baz < SomeSubclassOfActiveRecordBase
  has_many :foo, as: :wibble
end

The class of the wibble association when instantiated for Bar will be Bar.

The class of the wibble association when instantiated for Baz will be SomeSubclassOfActiveRecordBase, not Baz, unless SSOARB.abstract_class returns true.

Comments
Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *