Module: ActiveMusicbrainz::Model::Base::ClassMethods

Defined in:
lib/active_musicbrainz/models/base.rb

Instance Method Summary collapse

Instance Method Details

#has_artist_creditsObject



15
16
17
18
19
# File 'lib/active_musicbrainz/models/base.rb', line 15

def has_artist_credits
  belongs_to  :artist_credit, foreign_key: :artist_credit
  has_many    :artist_credit_names, through: :artist_credit
  has_many    :artists, through: :artist_credit_names
end

#has_gidObject



21
22
23
24
25
# File 'lib/active_musicbrainz/models/base.rb', line 21

def has_gid
  define_singleton_method :by_gid do |gid|
    find_by gid: gid
  end
end

#has_name(association_name) ⇒ Object



9
10
11
12
13
# File 'lib/active_musicbrainz/models/base.rb', line 9

def has_name association_name
  define_method :name do
    send(association_name).name
  end
end