lib/pipekit/repository.rb in pipekit-1.2.0 vs lib/pipekit/repository.rb in pipekit-2.0.0
- old
+ new
@@ -37,10 +37,11 @@
# find_by(github_username: "pipedriver")
# find_by(id: 123)
#
# Returns a Hash or nil if none found.
def find_by(options)
+ warn "Using `Repository#find_by` with an email may return inexact matches" if email_key?(options)
where(options, true).first
end
# Public: Create a record on Pipedrive.
#
@@ -92,8 +93,12 @@
result.map { |item| get_by_id(item["id"]) }.flatten
end
def resource
self.class.to_s.split("::").last.tap { |name| name[0] = name[0].downcase }
+ end
+
+ def email_key?(options)
+ options.keys.first && options.keys.first.to_s == "email"
end
end
end