Best practice for safe dynamic drops?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
Given models User and Publications where User has_many: publications, I need to iterate over a user's publications by calling {% for publication in user.publications %} and have access to methods defined in PublicationDrop.
user.publications is defined in the UserDrop class as just @user.publications.to_a.
For clarity, here is pseudocode of what I want to do:
Publications Authored by {{ user.full_name}}:
{% for publication in user.publications %}
# These methods should come from PublicationDrop
{{ publication.title }}
# Displays 'No Comments' if 0, otherwise displays number of comments
{{ publication.comment_count }}
{% endfor %}
I saw #64, and I'm sure I could adapt that to my needs. However, it is said in that thread that this method 'can have a huge security and performance impact'.
What I'm wondering is if the method described in #64 is still the best method, and if not, what is?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the approach referenced in issue #64, then inspect how UserDrop exposes user.publications and how PublicationDrop is expected to be used. Clarify whether that approach remains safe and performant, and document the recommended method for exposing publication data with the requested template behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- security
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100