-
Notifications
You must be signed in to change notification settings - Fork 639
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
Single Table Inherited audits #270
base: main
Are you sure you want to change the base?
Conversation
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.
Sorry for the delay! Just some minor comments.
Synario: | ||
```ruby | ||
class Patient < ActiveRecord::Base | ||
has_many :diseases |
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.
Nitpick, indentation should be two spaces (here and below).
@@ -265,6 +265,35 @@ class User < ActiveRecord::Base | |||
attr_protected :logins, :audit_ids | |||
end | |||
``` | |||
### Single Table Inherited(STI) table audits | |||
|
|||
If you're making audits for a STI record ,then you'll have to change your steps to identify the record's model.You wouldn't be able to retrieve `auditable_type` for the child table record associated audits as it always give parent table class name. |
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.
Missing space before "You wouldn't"
|
||
If you're making audits for a STI record ,then you'll have to change your steps to identify the record's model.You wouldn't be able to retrieve `auditable_type` for the child table record associated audits as it always give parent table class name. | ||
|
||
Synario: |
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.
Scenario
```ruby | ||
Patient.last.associated_audits.last.auditable.class.name | ||
``` | ||
Actually, in Single table inheritance (STI) each record will have a unique id so you can identify the record using the record id from the parent class as |
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.
I think here would be a good place to note that this only works if the audited record still exists (auditable
may be nil).
This PR has been open for over a year now with no activity. @jaswinder97 , do you think it's still needed and would you be interested in returning to this or should we close it? |
I'll try to complete it by this weekend.
On 21 Feb 2018 5:39 p.m., "Tomer Brisker" <[email protected]> wrote:
This PR has been open for over a year now with no activity. @jaswinder97
<https://github.com/jaswinder97> , do you think it's still needed and would
you be interested in returning to this or should we close it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#270 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARHmIXJkzsUJEryfEveih4AmCkssy6REks5tXAdsgaJpZM4H6oYt>
.
|
Ping @jaswinder97 ? do you think you'll get to this? |
Hi Tomer,
Yeah I have completed the changes few days back.Will push them by tomorrow
morning
…On 1 Apr 2018 7:35 p.m., "Tomer Brisker" ***@***.***> wrote:
Ping @jaswinder97 <https://github.com/jaswinder97> ? do you think you'll
get to this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#270 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARHmIfzEa8Q6hjkLfBtXUqAFKaI2cl0xks5tkN6cgaJpZM4H6oYt>
.
|
Single Table Inheritance will always store parent class name as auditable_type name instead of child class name but we can retrieve the actual child class name by first retrieving the auditable record and then identify its class name.