On Dec 1, 9:16pm, Michael P. [email protected] wrote:
At a guess, I’d say because “self.fixture_class_names=” is a method
that does some setting within it, while with the other syntax, you’re
trying to call a bang method on the return value of a method.
Getting very warm! self.fixture_class_names is (or at least was -
haven’t checked rails 3.1) a superclass_delegating_accessor.
This means that when you call it on a subclass it travels up the
inheritance hierarchy looking for a class where it has been set.
So if we had classes A < B < C < D, and A.fixture_class_names = x then
calling D.fixture_class_names checks D, then C, then B a lastly A
where it stops, since a value has been defined for A.
When you call C.fixture_class_names = y that doesn’t change what B
does (it checks B and then A), but it changes what D does (it checks
D, then C and returns y).
However, if you do C.fixture_class_names.merge! (without having
called C.fixture_class_names=) that will change the value that
‘belongs’ to A, thus changing what A.fixture_class_names and what