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 bug: unitialized constant NilClassDecorator no need to decorate an empty array anyways #314

Merged

Conversation

aokolish
Copy link
Contributor

I'm using draper on a project that uses ActiveResource and ran into this problem.

For example:

#given, Product has_many :attributes
# without draper involved
product.attributes 
# => []

# with draper, still no attributes
product = ProductDecorator.find(params[:id])
product.attributes
# => uninitialized constant NilClassDecorator

I think it would be better if draper just returned the empty array in this case.

@steveklabnik
Copy link
Member

Agreed. Thank you!

steveklabnik added a commit that referenced this pull request Oct 21, 2012
fix bug: unitialized constant NilClassDecorator no need to decorate an empty array anyways
@steveklabnik steveklabnik merged commit 46db7f3 into drapergem:master Oct 21, 2012
@steveklabnik
Copy link
Member

(Oh, and just so you know, we pulled ActiveResource out of Rails, so it's a gem now. It'll be maintained by rails core until rails 5)

@aokolish
Copy link
Contributor Author

Yup, I know all about that. Thanks for accepting this patch!

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.

2 participants