Rails models.

This commit is contained in:
Rico Sta. Cruz 2012-03-21 14:15:34 +08:00
parent 86b958a919
commit 2535439ad0
2 changed files with 16 additions and 4 deletions

4
ios.md
View File

@ -1,7 +1,3 @@
Path to Installous downloads:
/private/var/mobile/Documents/Installous/Downloads
Multiple Exchange accounts: Multiple Exchange accounts:
scp root@iphone.local:/private/var/mobile/Library/Preferences/com.apple.accountsettings.plist . scp root@iphone.local:/private/var/mobile/Library/Preferences/com.apple.accountsettings.plist .

View File

@ -84,6 +84,22 @@ And in migrations:
t.references :post, :polymorphic => true t.references :post, :polymorphic => true
end end
### Dynamic attribute-based finders
# Returns one record
Person.find_by_name(name)
Person.find_last_by_name(name)
Person.find_or_create_by_name(name)
# Returns a list of recordns
Person.find_all_by_name(name)
# Add a bang to make it raise an exception
Person.find_by_name!(name)
# Use `scoped` instead of `find`
Person.scoped_by_user_name
Validation Validation
---------- ----------