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

Forms Refactoring -Add ability to reference single document in collection #512

Merged
merged 8 commits into from
Oct 15, 2019

Conversation

cintamani
Copy link
Contributor

From: https://eaflood.atlassian.net/browse/RUBY-693

In Wex, using Active Record, we were able to simplify a lot our logic around addresses forms by redefining the association to the address as has_one associations.
Currently, there is no way to do the same with MongId 5.2, hence this adds some metaprogramming code that will allow a mode l to define a single object that is persisted inside a location and to override it.

…ction

From: https://eaflood.atlassian.net/browse/RUBY-693

In Wex, using Active Record, we were able to simplify a lot our logic around addresses forms by redefining the association to the address as `has_one` associations.
Currently, there is no way to do the same with MongId 5.2, hence this adds some metaprogramming code that will allow a mode l to define a single object that is persisted inside a location and to override it.
@cintamani cintamani added the enhancement New feature or request label Oct 14, 2019
@cintamani cintamani self-assigned this Oct 14, 2019
@cintamani cintamani force-pushed the reference-one-object-in-collection branch from 78e000e to f690846 Compare October 14, 2019 13:09
registration.registration_type != registration_type
end

def registration
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

@Cruikshanks Cruikshanks left a comment

Choose a reason for hiding this comment

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

Some grammar and typo suggestions for the comment

Comment on lines 3 to 6
# This module's aim is to implement a way to reference documetns in collection but singularly
# so that they can be treated as `has_one` associations. Currently on the WEX project we achieve the same
# functionality thanks to ActiveRecord Relation ability of specify custom associations using default scopes.
# But with the version of MongoId we use there is no ability of doing so.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# This module's aim is to implement a way to reference documetns in collection but singularly
# so that they can be treated as `has_one` associations. Currently on the WEX project we achieve the same
# functionality thanks to ActiveRecord Relation ability of specify custom associations using default scopes.
# But with the version of MongoId we use there is no ability of doing so.
# This module's aim is to implement a way to reference a single document in a
# collection so that they can then be treated as `has_one` associations.
# In projects using ActiveRecord like WEX we achieve the same functionality
# thanks to ActiveRecord's Relation ability to specify custom associations using
# default scopes. But because here we are using an old version of MongoDB, we
# are also stuck with a version of Mongoid which does not have this ability.

Copy link
Member

Choose a reason for hiding this comment

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

Turns out multiline comments don't apply to multiline suggestions ☹️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep it does not! Shame! :D

@cintamani cintamani merged commit c26a03d into master Oct 15, 2019
@Cruikshanks Cruikshanks deleted the reference-one-object-in-collection branch January 8, 2020 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants