Backport PR #4153 and #4224 to 3-2-stable

This is a rebase of commits from PR #4153 and #4224 to `3-2-stable`, with minor changes in a couple of commits.

This fixes issue #2572 with `set_fixture_class` and makes fixture table name be defined in the associated model.