find_one(id) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/finder_methods.rb, line 506
      def find_one(id)
        if ActiveRecord::Base === id
          raise ArgumentError,             You are passing an instance of ActiveRecord::Base to `find`.            Please pass the id of the object by calling `.id`..squish
        end

        relation = if klass.composite_primary_key?
          where(primary_key.zip(id).to_h)
        else
          where(primary_key => id)
        end

        record = relation.take

        raise_record_not_found_exception!(id, 0, 1) unless record

        record
      end
Register or log in to add new notes.