Sha256: d9a1f78d58355fde04bee54927345fe6b00d27b73d8f7f6290e10d85127c5da7

Contents?: true

Size: 650 Bytes

Versions: 12

Compression:

Stored size: 650 Bytes

Contents

# encoding: utf-8
class Document < ActiveRecord::Base
  has_one :section
  has_one :author
  acts_as_metadata
end

# Persist ancestor
class Section < ActiveRecord::Base
  belongs_to :document
  acts_as_metadata :ancestors => [:document], :persists_ancestor => true
end

# Does not persist ancestor
class Author < ActiveRecord::Base
  belongs_to :document
  acts_as_metadata :ancestors => [:document]
end

class Chapter < ActiveRecord::Base
  acts_as_metadata ancestors: [:sections, :document]
  has_many :sections
end

class User < ActiveRecord::Base
  has_one :inbox

  @@current_user = User.create!

  def self.current
    @@current_user
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
active_metadata-0.8.9 spec/support/models.rb
active_metadata-0.8.8 spec/support/models.rb
active_metadata-0.8.7.1 spec/support/models.rb
active_metadata-0.8.7 spec/support/models.rb
active_metadata-0.8.6 spec/support/models.rb
active_metadata-0.8.5.2 spec/support/models.rb
active_metadata-0.8.5.1 spec/support/models.rb
active_metadata-0.8.5 spec/support/models.rb
active_metadata-0.8.4 spec/support/models.rb
active_metadata-0.8.3.1 spec/support/models.rb
active_metadata-0.8.3 spec/support/models.rb
active_metadata-0.8.2 spec/support/models.rb