search for: find_all_by_contest_id

Displaying 1 result from an estimated 1 matches for "find_all_by_contest_id".

2006 Jun 09
0
Calculations based on multiple tables
...:Base has_many :songs, :order => :position end ------------------------ This is what I''m currently doing to perform the average on each song, but it seems like there should be a better way. def show_contest @contest = Contest.find(params[:id]) @contest_entries = ContestEntry.find_all_by_contest_id(@contest.id) @contest_entries.each do |contest_entry| songs = ContestRating.find_all_by_contest_entry_id (contest_entry.id.to_s) total = 0 songs.each do |song| total += song.score end average_score = total.to_f / songs.size.to_f song_name = Song.find_...