rails/activeresource — pull request #50 by DenzelMorris (2013-02-12 21:15:24+00:00)
Title: Add an attribute check to the belongs_to resolution chain

Given a resource
```ruby
class Resource < ActiveResource::Base
belongs_to :owner
end
```
And the following JSON return
```ruby
r = Resource.first
=> {
...
"owner": {
...
}
}
```
### Current Behavior
A *NoMethodError* is raised when trying to access the owner on the resource because the association attempts to find and use *owner_id* which isn't present.
```ruby
r.owner
=> NoMethodError ...
```

### Desired Behavior
My patch makes the belongs to association behave like the others. It will look for the association name in the attributes before attempting to load it from the endpoint. Giving:
```ruby
r.owner
=> #
```