module Believer::FinderMethods
Public Instance Methods
find(*args)
click to toggle source
Tests if there are any records present which conform to the argument filter(s) @param args [Object] a filter condition. This argument has the same usage as the where method
def exists?(*args)
super if defined?(super) && args.size == 0 where(*args).exists?
end
# File lib/believer/finder_methods.rb, line 11 def find(*args) return where(args[0]).first if args[0].is_a?(Hash) if primary_key_columns.size == 1 return where(primary_key_columns[0] => args).to_a if args.is_a?(Array) && args.size > 1 return where(primary_key_columns[0] => args[0]).first end nil end