APIdock / Ruby on Rails
/
Browse About
method

first!

v6.1.3.1 - Show latest stable - Class: ActiveRecord::FinderMethods
first!()
public

Same as #first but raises ActiveRecord::RecordNotFound if no record is found. Note that #first! accepts no arguments.

# File activerecord/lib/active_record/relation/finder_methods.rb, line 128
    def first!
      first || raise_record_not_found_exception!
    end

Related methods

  • Instance methods
  • exists?
  • fifth
  • fifth!
  • find
  • find_by
  • find_by!
  • first
  • first!
  • forty_two
  • forty_two!
  • fourth
  • fourth!
  • include?
  • last
  • last!
  • member?
  • raise_record_not_found_exception!
  • second
  • second!
  • second_to_last
  • second_to_last!
  • take
  • take!
  • third
  • third!
  • third_to_last
  • third_to_last!
  • Private methods
  • privateapply_join_dependency
  • privatecheck_reorder_deprecation
  • privateconstruct_relation_for_exists
  • privatefind_last
  • privatefind_nth
  • privatefind_nth_from_last
  • privatefind_nth_with_limit
  • privatefind_one
  • privatefind_some
  • privatefind_some_ordered
  • privatefind_take
  • privatefind_take_with_limit
  • privatefind_with_ids
  • privatelimited_ids_for
  • privateordered_relation
  • privateusing_limitable_reflections?
APIdock API Documentation Browser

© 2026 APIdock