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

Corrected method call to :loaded! in HasManyAssociation (fixes #383) #384

Merged
merged 1 commit into from
Apr 4, 2014
Merged

Corrected method call to :loaded! in HasManyAssociation (fixes #383) #384

merged 1 commit into from
Apr 4, 2014

Conversation

dchandekstark
Copy link
Member

The test added to has_many_associations_spec.rb fails without the fix.

The changes to associations_spec.rb were incidental -- one to change an equality statement into an expectation.

@@ -23,7 +23,7 @@ def count_records
# If there's nothing in the database and @target has no new records
# we are certain the current target is an empty array. This is a
# documented side-effect of the method that may avoid an extra SELECT.
@target ||= [] and loaded if count == 0
@target ||= [] and loaded! if count == 0
Copy link
Member

Choose a reason for hiding this comment

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

Should and be && here? I'm not suggesting anything is broken, but using and near assignment operators can cause unexpected issues due to the difference in precedence between it and &&. (&& is higher precedence than ||= and and is lower than ||=.)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

OK.

jcoyne added a commit that referenced this pull request Apr 4, 2014
Corrected method call to :loaded! in HasManyAssociation (fixes #383)
@jcoyne jcoyne merged commit f00d119 into samvera:master Apr 4, 2014
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.

3 participants