Skip to content

Commit

Permalink
chore: call name_like for all pacticipant searches
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 16, 2020
1 parent 6d975eb commit b5c4e39
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/pact_broker/pacticipants/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ class Repository
include PactBroker::Repositories::Helpers

def find_by_name name
if PactBroker.configuration.use_case_sensitive_resource_names
PactBroker::Domain::Pacticipant.where(name: name).single_record
else
pacticipants = PactBroker::Domain::Pacticipant.where(name_like(:name, name)).all
handle_multiple_pacticipants_found(name, pacticipants) if pacticipants.size > 1
pacticipants.first
end
pacticipants = PactBroker::Domain::Pacticipant.where(name_like(:name, name)).all
handle_multiple_pacticipants_found(name, pacticipants) if pacticipants.size > 1
pacticipants.first
end

def find_by_id id
Expand Down

0 comments on commit b5c4e39

Please sign in to comment.