To locate a specific item by name, you should use the find_by method instead of find, like this:
User.find_by(name: ["Black Flagged", "Black Flag"])
Moreover, if you are working with a JavaScript array using the native find method and assuming the array is _($scope.reasonOfRejection)
, you can implement it this way:
_($scope.reasonOfRejection).find(({ name }) => (
name.en === "Black Flagged" || name.en === "Black Flag"
))
The find function will return the first item that meets the specified condition. If you wish to retrieve an array of all matching items, you should use the filter method instead.
const array = [{name: { en: "another item"}}, {name: { en: "item"}}, {name: { en: "Black Flagged"}}]
const match = array.find(({ name }) => (
name.en === "Black Flagged" || name.en === "Black Flag"
))
console.log(match)