zed.0xff.me

Rails 3.x "Crazy Loading" is awesome!

1
2
3
4
5
6
7
8
red_items = Item.where(:colour => 'red')
red_items.find(1)
item = red_items.new
item.colour #=> 'red'

red_items.exists? #=> true
red_items.update_all :colour => 'black'
red_items.exists? #=> false

// actually it’s “Lazy Loading” and stuff. Read more: Active Record Query Interface 3.0.