@@ -0,0 +1,14 | |||||
|
1 | class CreateChangesetParents < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | create_table :changeset_parents, :id => false do |t| | |||
|
4 | t.column :changeset_id, :integer, :null => false | |||
|
5 | t.column :parent_id, :integer, :null => false | |||
|
6 | end | |||
|
7 | add_index :changeset_parents, [:changeset_id], :unique => false, :name => :changeset_parents_changeset_ids | |||
|
8 | add_index :changeset_parents, [:parent_id], :unique => false, :name => :changeset_parents_parent_ids | |||
|
9 | end | |||
|
10 | ||||
|
11 | def self.down | |||
|
12 | drop_table :changeset_parents | |||
|
13 | end | |||
|
14 | end |
@@ -22,6 +22,14 class Changeset < ActiveRecord::Base | |||||
22 | belongs_to :user |
|
22 | belongs_to :user | |
23 | has_many :changes, :dependent => :delete_all |
|
23 | has_many :changes, :dependent => :delete_all | |
24 | has_and_belongs_to_many :issues |
|
24 | has_and_belongs_to_many :issues | |
|
25 | has_and_belongs_to_many :parents, | |||
|
26 | :class_name => "Changeset", | |||
|
27 | :join_table => "#{table_name_prefix}changeset_parents#{table_name_suffix}", | |||
|
28 | :association_foreign_key => 'parent_id', :foreign_key => 'changeset_id' | |||
|
29 | has_and_belongs_to_many :children, | |||
|
30 | :class_name => "Changeset", | |||
|
31 | :join_table => "#{table_name_prefix}changeset_parents#{table_name_suffix}", | |||
|
32 | :association_foreign_key => 'changeset_id', :foreign_key => 'parent_id' | |||
25 |
|
33 | |||
26 | acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.format_identifier}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments))}, |
|
34 | acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.format_identifier}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments))}, | |
27 | :description => :long_comments, |
|
35 | :description => :long_comments, |
General Comments 0
You need to be logged in to leave comments.
Login now