ShelbyTV / shelby_gt

Rails API services for Shelby GT
2 stars 0 forks source link

Roll should keep .frame_count #78

Closed spinosa closed 12 years ago

spinosa commented 12 years ago

use atomic incrementing on Frame#create and decrementing on Frame#destroy -- could do this very simply as an after filter

will need to default this to 0 and will need to run through all Rolls in DB updating frame_count Roll.find_each.each { |r| r.update_attribute(:frame_count, r.frames.count) }

be sure to write tests

return this attribute whenever returning rolls