class Release < ActiveRecord::Base set_table_name 'musicbrainz.bh_release' def self.getReleases(release_groups, group_by_release = false, only_official = false) releases = Release.all( :conditions => [ 'release_group IN(?) AND '+ (only_official ? 'release_type=1' : 'release_type IS NOT NULL'), release_groups ], :order => 'date ASC, id ASC' ) if group_by_release g_releases = {} releases.each do |release| if g_releases[release.release_group].nil? g_releases[release.release_group] = {} end g_releases[release.release_group] << release end return g_releases end return releases end end