Fixed a regression introduced in 84cf156

84cf156 (PR #15694) introduced a subtle regression. There are actually three
distinct entry points to creating an AR object – via .new (i.e. #initialize),
via #init_with (e.g. from YAML or database queries) and via .allocate.

With the patch in 84cf156, attribute methods and respond_to? will not work
correctly when objects are allocated directly, without going through either

The reason this test case didn't catch the regression was that the `Topic`
class is shared between test cases, so by the time this test case is ran the
attribute methods are very likely to be defined.

Switching to use a fresh anonymous class in the test to ensure we surface this
problem in the future.
...Can they stop? :P

This seems fine to merge in seriousness.
On Jun 14, 2014 4:09 PM, "Zachary Scott" <notifications@github.com> wrote:

> In activerecord/test/cases/attribute_methods_test.rb:
>
> > @@ -143,7 +143,11 @@ def test_id_before_type_cast_with_custom_primary_key
> >
> >    # Syck calls respond_to? before actually calling initialize
>
> @sgrif <https://github.com/sgrif> Syck still has users not on 1.8.7
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/rails/rails/pull/15718/files#r13783091>.
>