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

Add concern for polymorphic relation #1

Closed
wants to merge 4 commits into from
Closed

Conversation

kieranklaassen
Copy link
Owner

@kieranklaassen kieranklaassen commented Aug 22, 2024


For more details, open the Copilot Workspace session.

@kieranklaassen
Copy link
Owner Author

✨✨ Here's an AI-assisted sketch of how you might approach this issue saved by @kieranklaassen using Copilot Workspace v0.23

Topic

Has the concern for the @dataset_record.rb polymorphic relation been introduced, adding a has_many field and the three methods from @text_content.rb?

Before
  • No, the concern for the polymorphic relation in app/models/leva/dataset_record.rb has not been introduced.
  • app/models/leva/dataset_record.rb does not include a concern for the polymorphic relation.
  • The has_many field is already present in app/models/leva/dataset_record.rb.
  • The three methods from test/dummy/app/models/text_content.rb are already present in app/models/leva/dataset_record.rb.
  • README.md does not reflect any steps related to adding a concern for the polymorphic relation.
After
  • Yes, the concern for the polymorphic relation in app/models/leva/dataset_record.rb has been introduced.
    • Create a new concern file app/models/concerns/recordable_concern.rb with the content from test/dummy/app/models/text_content.rb. Rais enot implemented
    • Include the RecordableConcern in app/models/leva/dataset_record.rb.
  • README.md now reflects all steps needed to add the Leva concern.
    • Add a section in README.md explaining how to add the concern for the polymorphic relation.
  • add the concern to the @text_content.rb and the concern should just be a raise not implemented, not the dataset_record!
  • do not remove the methods!! you need to overwirt them, also move to_llm_context there
  • do not move display name
  • move back display name to data_record
Plan
  • app/models/concerns/recordable_concern.rb (ADD)
    • Define a module RecordableConcern
    • Add index_attributes method that raises NotImplementedError
    • Add show_attributes method that raises NotImplementedError
    • Add to_llm_context method that raises NotImplementedError
  • test/dummy/app/models/text_content.rb (CHANGE)
    • Include RecordableConcern
    • Override index_attributes method
    • Override show_attributes method
    • Override to_llm_context method
  • app/models/leva/dataset_record.rb (CHANGE)
  • README.md (CHANGE)
    • Add a section explaining how to add the concern for the polymorphic relation
Sketch of implementation

View the changes

Details

Code analyzed at 48413f0

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.

1 participant