Sha256: 9df56168e7174ea97dd27748d62390493bc535af62955a7353f3be34e8c21c17

Contents?: true

Size: 617 Bytes

Versions: 10

Compression:

Stored size: 617 Bytes

Contents

class SongOccurence < ActiveRecord::Base
  include Extensions::UUID

  belongs_to :show, :foreign_key => :show_uuid, :primary_key => :uuid
  belongs_to :song_ref, :foreign_key => :song_ref_uuid, :primary_key => :uuid, :counter_cache => true
  accepts_nested_attributes_for :show

  def self.create_from(spec)
    occurence = SongOccurence.new
    set_spec(occurence, spec)
    occurence.save
    occurence
  end

  private

  def self.set_spec(occurence, spec)
    occurence.uuid = spec[:uuid]
    occurence.position = spec[:position]    
    occurence.show = ShowSet.find_by_uuid(spec[:show_set_uuid]).show
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gdshowsdb-4.0.2 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-4.0.1 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-4.0.0 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-3.0.0 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-2.1.0 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-2.0.0 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-1.0.3 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-1.0.2 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-1.0.1 lib/gdshowsdb/models/song_occurence.rb
gdshowsdb-1.0.0 lib/gdshowsdb/models/song_occurence.rb