-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Add support for alternative IDs using Hashids #2564
base: main
Are you sure you want to change the base?
Conversation
Code Climate has analyzed commit d58b9c6 and detected 0 issues on this pull request. View more on Code Climate. |
This PR has been marked as stale because there was no activity for the past 15 days. |
What is the status on this one? |
@gabrielgiroe1 what is the status on this one? |
The real ID is leaking on attach request params, let's try to find out more spots like this one and fix them. |
…2749) Bumps the npm_and_yarn group with 1 update in the / directory: [trix](https://github.com/basecamp/trix). Updates `trix` from 2.1.0 to 2.1.1 - [Release notes](https://github.com/basecamp/trix/releases) - [Commits](basecamp/trix@v2.1.0...v2.1.1) --- updated-dependencies: - dependency-name: trix dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> Co-authored-by: Adrian Marin <adrian@adrianthedev.com>
git reset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is generally ok.
I have a couple of questions and one more critical change request.
Good job taking it this far!
app/components/avo/fields/belongs_to_field/edit_component.html.erb
Outdated
Show resolved
Hide resolved
app/components/avo/fields/belongs_to_field/edit_component.html.erb
Outdated
Show resolved
Hide resolved
lib/avo/fields/belongs_to_field.rb
Outdated
def target_resource(record: @record, polymorphic_model_class: value&.class) | ||
@target_resource ||= if use_resource.present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not right.
We can't memoize a value in a method if the method takes arguments.
If one time the record
is a User
, it will get memoized as that user. Then, the second time when the record
is a team
, it will return the first user, resulting in a bug.
Did I read that correctly?
lib/avo/fields/belongs_to_field.rb
Outdated
@@ -229,22 +238,22 @@ def database_id | |||
id | |||
end | |||
|
|||
def target_resource | |||
def target_resource(record: @record, polymorphic_model_class: value&.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'd like to maintain target_resource
as a method without params so we can quickly call field.target_resource
when we need to.
Description
Fixes #2563
Checklist:
Screenshots & recording
Manual review steps
Manual reviewer: please leave a comment with output from the test if that's the case.