On registration the before_save object gets called before the before_create object.

    before_save  :denullify_arrays
    before_create :set_defaults, :build_preferences

So what ends up happening is denullify_arrays tries to access preferences before they are actually built and it can't so it throws an error.