trptcolin/consistency_fail — pull request #21 by fw42 (2014-09-22 22:42:24+00:00)
Title: Use AssociationReflection#klass rather than constantizing the #class_name

This fixes a small bug that appears when using namespaced model names.. Something like this:

```ruby
class Foo < ActiveRecord::Base
has_one :bar
end
```
in app/models/foo.rb and
```ruby
class Foo::Bar < ActiveRecord::Base
end
```
in app/models/foo/bar.rb (with table name foo_bars).

That will work just fine in Rails, but the current code on master will raise a NameError exception because it tries to constantize "Bar" (rather than "Foo::Bar"). This PR fixes that by using the [AssociationReflection#klass](http://www.rubydoc.info/docs/rails/3.0.0/ActiveRecord/Reflection/AssociationReflection#klass-instance_method) rather than #constantize on #class_name, which is already smart enough to find the right class.

I didn't add any tests yet because the tests (on master) don't pass for me locally.. Are they supposed to?

@trptcolin, please take a quick look