The Query Interface

where, order, limit, find_by

Every model gets these query methods for free, and they read almost like English. where takes a hash of conditions; order sorts; limit caps how many rows come back; find_by returns the first match or nil:

Walker.where(city: "Austin")
Walker.where(price_per_30_min_cents: 2000..2500)   # a Ruby Range works as a BETWEEN
Walker.order(:price_per_30_min_cents)
Walker.limit(1)
Walker.find_by(name: "Sam")                        # one record, or nil β€” never raises

You can chain all of these together, because each one returns something you can keep calling methods on β€” not a final result.