Skip to content

detect should be replaced by find_by #183

@lelelelemon

Description

@lelelelemon

ror_ecommerce/app/views/admin/rma/return_authorizations/_form.html.erb

<% return_item = @return_authorization.return_items.detect {|p| p.order_item_id == item.id } %>
will issue a query to get all return_items of @return_authorization, and then detect them to find the one with specified item.id.
However, use find_by will only issue the query use where condition
@return_authorization.return_items.find_by(order_item_id: item.id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions