annotate .svn/pristine/f8/f870c3ba20ea2ddf0ff2322592df44a3f659e500.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 class Page < ActiveRecord::Base
Chris@909 2 belongs_to :author
Chris@909 3 has_many :authors, :through => :versions, :order => 'name'
Chris@909 4 belongs_to :revisor, :class_name => 'Author'
Chris@909 5 has_many :revisors, :class_name => 'Author', :through => :versions, :order => 'name'
Chris@909 6 acts_as_versioned :if => :feeling_good? do
Chris@909 7 def self.included(base)
Chris@909 8 base.cattr_accessor :feeling_good
Chris@909 9 base.feeling_good = true
Chris@909 10 base.belongs_to :author
Chris@909 11 base.belongs_to :revisor, :class_name => 'Author'
Chris@909 12 end
Chris@909 13
Chris@909 14 def feeling_good?
Chris@909 15 @@feeling_good == true
Chris@909 16 end
Chris@909 17 end
Chris@909 18 end
Chris@909 19
Chris@909 20 module LockedPageExtension
Chris@909 21 def hello_world
Chris@909 22 'hello_world'
Chris@909 23 end
Chris@909 24 end
Chris@909 25
Chris@909 26 class LockedPage < ActiveRecord::Base
Chris@909 27 acts_as_versioned \
Chris@909 28 :inheritance_column => :version_type,
Chris@909 29 :foreign_key => :page_id,
Chris@909 30 :table_name => :locked_pages_revisions,
Chris@909 31 :class_name => 'LockedPageRevision',
Chris@909 32 :version_column => :lock_version,
Chris@909 33 :limit => 2,
Chris@909 34 :if_changed => :title,
Chris@909 35 :extend => LockedPageExtension
Chris@909 36 end
Chris@909 37
Chris@909 38 class SpecialLockedPage < LockedPage
Chris@909 39 end
Chris@909 40
Chris@909 41 class Author < ActiveRecord::Base
Chris@909 42 has_many :pages
Chris@909 43 end