Skip to content

Instantly share code, notes, and snippets.

@shu0115
Created March 27, 2012 03:34
Show Gist options
  • Save shu0115/2212292 to your computer and use it in GitHub Desktop.
Save shu0115/2212292 to your computer and use it in GitHub Desktop.
where/find/find_by_idのそれぞれのクラス名
◆where
user_test = User.where( :id => 1 )
user_test.class.name # => "ActiveRecord::Relation"
user_test.first.class.name # => "User"
user_test.all.class.name # => "Array"
user_test.all.first.class.name # => "User"
◆find
user_test2 = User.find( 1 )
user_test2.class.name # => "User"
◆find_by_id
user_test3 = User.find_by_id( 1 )
user_test3.class.name # => "User"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment