Skip to content

Conversation

@dturnerTS
Copy link
Contributor

A get request that receives no data returns an instance. However, the fetch method has_many_association implicitly assumes it will receive a collection. When it instead receives an instance https://github.com/remiprev/her/blob/master/lib/her/model/associations/has_many_association.rb#L88
attempts to iterate over the instance and raises an exception.

This patch ensures that we always operate on a collection and allows delegated methods to work even when the response from the get request is blank. e.g. fixes #187

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better if this'd be done when calling super?

dturnerTS added 2 commits July 7, 2014 08:56
…fetch that the response should be a collection, instead of turning the response into a collection.
* master:
  Fix data cache on model for associations, fixes remi#248
  Update README.md

Conflicts:
	lib/her/model/associations/association.rb
	spec/model/associations_spec.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

blank? returns false for a nested resource that is null

2 participants