What is the fastest way to find the first record in Rails (ActiveRecord)?

activerecord, ruby-on-rails, ruby-on-rails-3

Solution

Both would produce the same query.

According to the latest information, under Rails 3.1, passing in :conditions will be deprecated.

Hence, right now, the best way to execute the query is to use:

Class.where(:type => 4).first

Problem

I would like to know which method is fastest for return a record. ``` Class.where(:type => 4).first Class.find(:first, :conditions => ["type = ?", 4]) ``` Is the execution exactly the same?

Original source