Sha256: 556062b45fce3b934ff995d9c9d5b1b39f83529ed0c770c0da58c60b945da926

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 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_rails3 :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_rails3 \
    :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

class Author < ActiveRecord::Base
  has_many :pages
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_versioned_rails3-0.6.2 test/fixtures/page.rb
acts_as_versioned_rails3-0.6.1 test/fixtures/page.rb