Skip to content

unused data #517

Closed
Closed
@hyperloop-rails

Description

@hyperloop-rails

votes = self.where(
:user_id => user_id,
:comment_id => comment_ids,
)
votes.inject({}) do |memo, v|
memo[v.comment_id] = { :vote => v.vote, :reason => v.reason }

There is unused data retrieval, only comment_id, vote, reason of Vote is used, so the code can be modified to:
votes = self.where( :user_id => user_id, :comment_id => comment_ids, ).select(:comment_id, vote, reason)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions