Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
##book.rb has_many :reviews, :dependent => :delete_all do def overall_rating(record) to_a.sum(&record) end end ##irb >> b = Book.find(2) => #<Book id: 2, firstname: "Zach", lastname: "Wentz", approved: true, overall: nil, rating1: nil, rating2: nil, rating3: nil, rating4: nil, created_at: "2008-05-23 17:18:18", updated_at: "2008-05-24 14:16:30"> >> b.reviews.overall_rating(:overall) => 5
This paste will be private.
From the Design Piracy series on my blog: