Created
July 18, 2011 06:07
-
-
Save luckydev/1088655 to your computer and use it in GitHub Desktop.
ActiveRecord Finder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p180 :001 > Account.find(34) | |
ActiveRecord::RecordNotFound: Couldn't find Account with ID=34 | |
from /Users/lakshman/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.5/lib/active_record/relation/finder_methods.rb:296:in `find_one' | |
from /Users/lakshman/.rvm/gems/ruby-1.9.2-p180/gems/activerecord- | |
ruby-1.9.2-p180 :002 > Account.where(:id => 34).first | |
=> nil | |
ruby-1.9.2-p180 :003 > Account.where(:id => 34) | |
=> [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acc = Account.find(34) | |
acc = Account.where(:id => 34).first | |
acc = Account.where(:id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment