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

Benefits of using polymorphic association in ruby on rails #185

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hulksyed07
Copy link
Contributor

What did you do?

Please include a summary of the changes.

  • Added this
  • Updated that

Why did you do it?

Why were these changes made?

  • This was missing
  • that needed changes

Screenshots (Please include if anything visual)

Include any relevant screenshots that may help explain the change.


## Illustrating Polymorphic Association with AWS Synchronization

Let's integrate a real-world example of polymorphic association for tracking AWS synchronization for two distinct models: `Patient` and `Doctor`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can say, "Let's look at/explore a real world example"

## 5. Easy Attachability

Enabling functionality for multiple models becomes a seamless process with polymorphic association.
In our example, where functionality is enabled for three models, additional models can adopt the same functionality without requiring any database changes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we present the example before this?


The ease of attaching functionality to different models not only simplifies the development process but also helps in avoiding code duplication.

As mentioned in point number 5, incorporating a module for a specific functionality ensures that the same codebase can be reused across various models, promoting cleaner and more maintainable code.
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can link the point no. 5 heading hete


In this blog post, we'll explore the advantages of leveraging polymorphic association in Ruby on Rails.

## 1. Storage Saving
Copy link
Collaborator

Choose a reason for hiding this comment

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

Efficient Storage Use?

By separating functionality into dedicated tables, developers can create indexes tailored to specific needs without impacting the performance of the main table.
This approach contributes to a more efficient and responsive application.

## 5. Easy Attachability
Copy link
Collaborator

@2KAbhishek 2KAbhishek Nov 13, 2023

Choose a reason for hiding this comment

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

We should explain attachability in this context as it is not that commonly used

Copy link
Collaborator

@2KAbhishek 2KAbhishek left a comment

Choose a reason for hiding this comment

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

Made formatting fixes, left some suggestions

LGTM otherwise

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

3 participants