You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since any note should belong to a folder, any note can have an aliase, and any note has an access control model, these features in common should be abstracted away in Rails. Some common approaches:
1. Polymorphic Models
Folder Association
Define a Folder model, and make the association polymorphic if multiple models need to belong to folders:
Since any note should belong to a folder, any note can have an aliase, and any note has an access control model, these features in common should be abstracted away in Rails. Some common approaches:
1. Polymorphic Models
Folder Association
Define a
Folder
model, and make the association polymorphic if multiple models need to belong to folders:Alias
An alias can also be modeled using a polymorphic association:
Access Control
You can use a role-based model or a simple ownership model to handle access control:
2. Applying the Concerns
Use these concerns in your
Note
model:3. Database Migrations
Run migrations to add polymorphic fields and other attributes:
4. Usage
Create a note with all these common features:
Benefits
Article
orTask
.Note
model.The text was updated successfully, but these errors were encountered: