Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors for find #13

Merged
merged 3 commits into from
Jul 29, 2015
Merged

Conversation

sringling
Copy link
Contributor

When doing a find, there cannot be any errors. We just need to default it to ActiveModel::Errors.
ApiErrors returns different things sometimes, and we cannot load some things using [] or {}, if it expected ActiveModel::Errors.

Seth Ringling added 2 commits July 29, 2015 09:57
When doing a find, there cannot be any errors.  We just need to default it to ActiveModel::Errors.
ApiErrors returns different things sometimes, and we cannot load some things using [] or {}, if it expected ActiveModel::Errors.
@@ -45,7 +45,8 @@ def single_result(results)

result.meta = results.meta

result.errors = ApiErrors(results.errors)
# There will never be errors here but this provides a good default for forms
result.errors = ActiveModel::Errors.new(result)
Copy link
Contributor

Choose a reason for hiding this comment

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

since result is a Resource which has the include ActiveModel::Validations module, do we need this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, it is not required because we do the same defaulting in resource. I removed it.

@bluetwin
Copy link
Contributor

👍

bluetwin pushed a commit that referenced this pull request Jul 29, 2015
@bluetwin bluetwin merged commit 0dfa839 into avvo:master Jul 29, 2015
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.

None yet

2 participants