24 lines
620 B
Ruby
24 lines
620 B
Ruby
module JamRuby
|
|
class Band < ActiveRecord::Base
|
|
|
|
self.primary_key = 'id'
|
|
|
|
# musicians
|
|
has_many :band_musicians
|
|
has_many :users, :through => :band_musicians, :class_name => "JamRuby::User"
|
|
|
|
# genres
|
|
has_and_belongs_to_many :genres, :class_name => "JamRuby::Genre", :join_table => "bands_genres"
|
|
|
|
def photo_url
|
|
# TODO: move image path to config
|
|
@photo_url = "http://www.jamkazam.com/images/bands/photos/#{self.id}.gif"
|
|
end
|
|
|
|
def logo_url
|
|
# TODO: move image path to config
|
|
@logo_url = "http://www.jamkazam.com/images/bands/logos/#{self.id}.gif"
|
|
end
|
|
|
|
end
|
|
end |