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

Fixing includes to properly build and set the association. #12

Merged
merged 7 commits into from
Mar 14, 2023

Conversation

asedge
Copy link
Collaborator

@asedge asedge commented Mar 9, 2023

Prior to this fix ActiveForce::ActiveQuery would properly fetch the associated records but would not know how to assign them so referencing the association would result in another query to Salesforce. We added a mapping of Salesforce relation names to the defined association name to accomplish this.

…izes the `relationship_name`. Also fixed a test that was expecting a thing to be cached but was not ever added to the `includes`... curious how that test was passing before.
@asedge asedge marked this pull request as ready for review March 9, 2023 21:20
@asedge asedge changed the title First pass at fixing includes to properly build and set the associa… Fixing includes to properly build and set the association. Mar 9, 2023
@asedge asedge requested a review from JeffLuckett March 9, 2023 22:29
Copy link
Contributor

@JeffLuckett JeffLuckett left a comment

Choose a reason for hiding this comment

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

Looks good to me ... do you need to bump the patch version?

@asedge
Copy link
Collaborator Author

asedge commented Mar 10, 2023

Looks good to me ... do you need to bump the patch version?

Yeah, good call. I'll also update the CHANGELOG.

asedge added 4 commits March 10, 2023 09:47
…n because our `table_name` may not match the capitalization of the SF relationship field.
…siness rules say it is a `has_one` we will end up with an array of 1. This will guard against that unlikely scenario.
Copy link
Contributor

@JeffLuckett JeffLuckett left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -1,8 +1,17 @@
module ActiveForce
module Association
class BelongsToAssociation < Association

def relationship_name
options[:relationship_name] || default_relationship_name
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@JeffLuckett JeffLuckett merged commit f1430fb into main Mar 14, 2023
@JeffLuckett JeffLuckett deleted the bugfix/fix_includes_so_association_data_is_saved branch March 14, 2023 14:00
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