method
find_one
find_one(id, options)
private
Hide source
# File activerecord/lib/active_record/base.rb, line 1518 def find_one(id, options) conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions] options.update :conditions => "#{quoted_table_name}.#{connection.quote_column_name(primary_key)} = #{quote_value(id,columns_hash[primary_key])}#{conditions}" # Use find_every(options).first since the primary key condition # already ensures we have a single record. Using find_initial adds # a superfluous :limit => 1. if result = find_every(options).first result else raise RecordNotFound, "Couldn't find #{name} with ID=#{id}#{conditions}" end end