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

Update "Active Record Associations" guide [ci skip] #31316

Merged
merged 1 commit into from
Dec 16, 2017

Conversation

bogdanvlviv
Copy link
Contributor

@bogdanvlviv bogdanvlviv commented Dec 2, 2017

  • Make all ActiveRecord::Base.find as link

  • Remove "It also adds the additional condition that the object must be in the collection."
    sentence for collection.where since it isn't correct statement.
    Remove the sentence for collection.find for consistency with others.

  • Remove redundant sentences
    "It also adds the additional condition that the object must be in the collection."

@rails-bot
Copy link

r? @rafaelfranca

(@rails-bot has picked a reviewer for you, use r? to override)

@kaspth
Copy link
Contributor

kaspth commented Dec 3, 2017

Merely saying "Update" in the commit message doesn't cut it for me. Please elaborate what you've changed and why.

@bogdanvlviv bogdanvlviv force-pushed the update-association_basics-guide branch from a1fe3fc to 6347fe8 Compare December 3, 2017 18:57
@kaspth
Copy link
Contributor

kaspth commented Dec 6, 2017

It also adds the additional condition that the object must be in the collection.

What's wrong about this? post.comments.where(…) would still end up with SELECT * FROM comments WHERE post_id = ?, no?

@bogdanvlviv bogdanvlviv force-pushed the update-association_basics-guide branch from 6347fe8 to 8cc7c3c Compare December 6, 2017 19:34
@bogdanvlviv
Copy link
Contributor Author

@kaspth Thanks for the review. looks like I was misunderstanding the sentence "It also adds the additional condition that the object must be in the collection". I just removed changes related to this.

The `collection.find` method finds objects within the collection. It uses the same syntax and options as `ActiveRecord::Base.find`. It also adds the additional condition that the object must be in the collection.
The `collection.find` method finds objects within the collection. It uses the same syntax and options as
[`ActiveRecord::Base.find`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find).
It also adds the additional condition that the object must be in the collection.
Copy link
Member

Choose a reason for hiding this comment

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

The collection.find method finds objects within the collection. [...] It also adds the additional condition that the object must be in the collection.

This seems totally redundant to me; I think you were right to remove it initially.

I think what it's trying to say is that collection.find behaves identically to ActiveRecord::Base.find, except that the query will be scoped to the collection. I think that's clear enough from the first two sentences, though.

WDYT @kaspth?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the line is totally redundant and can be removed. @bogdanvlviv has expressed interest in upping his contributions, so I'm badgering him to explain his understanding and come up with better arguments for it.

In other words: the line shouldn't be removed because "it's wrong" (it ain't), but it should be removed because it's redundant. Bogdan, you know what to do 😊

Copy link
Member

Choose a reason for hiding this comment

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

Apologies, I didn't recognise the Socratic method at work here. 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

@eugeneius pretty hidden, so no worries! 😊

@bogdanvlviv cool 👍

  - Make all `ActiveRecord::Base.find` as link
  - Remove redundant sentences
    "It also adds the additional condition that the object must be in the collection."
@bogdanvlviv bogdanvlviv force-pushed the update-association_basics-guide branch from 8cc7c3c to ff214c3 Compare December 14, 2017 21:33
@kaspth kaspth merged commit 28d2968 into rails:master Dec 16, 2017
@bogdanvlviv bogdanvlviv deleted the update-association_basics-guide branch December 17, 2017 18:40
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

5 participants