Sha256: 3f31e6ee03e8cb4169f4c7e13e4cbe3f452c76457ba87e6518871e9b9ca77fa8

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

class Page < ActiveRecord::Base
  belongs_to :author
  has_many   :authors,  :through => :versions, :order => 'name'
  belongs_to :revisor,  :class_name => 'Author'
  has_many   :revisors, :class_name => 'Author', :through => :versions, :order => 'name'
  acts_as_versioned :if => :feeling_good? do
    def self.included(base)
      base.cattr_accessor :feeling_good
      base.feeling_good = true
      base.belongs_to :author
      base.belongs_to :revisor, :class_name => 'Author'
    end
    def feeling_good?
      @@feeling_good == true
    end
  end
end

module LockedPageExtension
  def hello_world
    'hello_world'
  end
end

class LockedPage < ActiveRecord::Base
  acts_as_versioned \
    :inheritance_column => :version_type, 
    :foreign_key        => :page_id, 
    :table_name         => :locked_pages_revisions, 
    :class_name         => 'LockedPageRevision',
    :version_column     => :lock_version,
    :limit              => 2,
    :if_changed         => :title,
    :extend             => LockedPageExtension
end

class SpecialLockedPage < LockedPage
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
decisiv-acts_as_versioned-0.6.1 test/models/page.rb
decisiv-acts_as_versioned-0.6.2.1 test/models/page.rb
decisiv-acts_as_versioned-0.6.3.1 test/models/page.rb
metaskills-acts_as_versioned-0.6.0 test/models/page.rb
metaskills-acts_as_versioned-0.6.1 test/models/page.rb
metaskills-acts_as_versioned-0.6.2 test/models/page.rb
metaskills-acts_as_versioned-0.6.3 test/models/page.rb
xmlblog-acts_as_versioned-0.6.4 test/models/page.rb
xmlblog-acts_as_versioned-0.6.5 test/models/page.rb