acts_as_audited_collection 0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,69 @@
1
+ # Released under the MIT license. See the LICENSE file for details
2
+
3
+ class TestParent < ActiveRecord::Base
4
+ has_many :test_children
5
+ has_many :other_test_children,
6
+ :class_name => 'TestChild', :foreign_key => 'other_test_parent_id'
7
+ has_many :test_children_with_only,
8
+ :class_name => 'TestChild', :foreign_key => 'test_parent_with_only_id'
9
+ has_many :test_children_with_except,
10
+ :class_name => 'TestChild', :foreign_key => 'test_parent_with_except_id'
11
+
12
+ acts_as_audited_collection_parent :for => :test_children
13
+ acts_as_audited_collection_parent :for => :other_test_children
14
+ acts_as_audited_collection_parent :for => :test_children_with_only
15
+ acts_as_audited_collection_parent :for => :test_children_with_except
16
+ end
17
+
18
+ class TestChild < ActiveRecord::Base
19
+ belongs_to :test_parent
20
+ belongs_to :other_test_parent,
21
+ :class_name => 'TestParent'
22
+ belongs_to :test_parent_with_only,
23
+ :class_name => 'TestParent'
24
+ belongs_to :test_parent_with_except,
25
+ :class_name => 'TestParent'
26
+
27
+ has_many :test_grandchildren
28
+ has_many :test_soft_delete_grandchildren
29
+
30
+ acts_as_audited_collection :parent => :test_parent
31
+ acts_as_audited_collection :parent => :other_test_parent,
32
+ :name => :other_test_children,
33
+ :track_modifications => true
34
+ acts_as_audited_collection :parent => :test_parent_with_only,
35
+ :name => :test_children_with_only,
36
+ :track_modifications => true,
37
+ :only => :name
38
+ acts_as_audited_collection :parent => :test_parent_with_except,
39
+ :name => :test_children_with_except,
40
+ :track_modifications => true,
41
+ :except => :name
42
+
43
+ acts_as_audited_collection_parent :for => :test_grandchildren
44
+ acts_as_audited_collection_parent :for => :test_soft_delete_grandchildren
45
+ end
46
+
47
+ class TestGrandchild < ActiveRecord::Base
48
+ belongs_to :test_child
49
+
50
+ has_many :test_great_grandchildren
51
+
52
+ acts_as_audited_collection :parent => :test_child, :cascade => true,
53
+ :track_modifications => true
54
+
55
+ acts_as_audited_collection_parent :for => :test_great_grandchildren
56
+ end
57
+
58
+ class TestGreatGrandchild < ActiveRecord::Base
59
+ belongs_to :test_grandchild
60
+
61
+ acts_as_audited_collection :parent => :test_grandchild, :cascade => true
62
+ end
63
+
64
+ class TestSoftDeleteGrandchild < ActiveRecord::Base
65
+ belongs_to :test_child
66
+
67
+ acts_as_audited_collection :parent => :test_child, :soft_delete => {:deleted => 1},
68
+ :cascade => true, :track_modifications => true
69
+ end
@@ -0,0 +1,19 @@
1
+ # Released under the MIT license. See the LICENSE file for details
2
+
3
+ begin
4
+ require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
5
+ rescue LoadError
6
+ puts "You need to install rspec in your base app"
7
+ exit
8
+ end
9
+
10
+ plugin_spec_dir = File.dirname(__FILE__)
11
+ ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
12
+
13
+ databases = YAML::load(IO.read(plugin_spec_dir + "/db/database.yml"))
14
+ ActiveRecord::Base.establish_connection(databases[ENV["DB"] || "sqlite3"])
15
+ load(File.join(plugin_spec_dir, "db", "schema.rb"))
16
+
17
+ require File.join(File.dirname(__FILE__), '..', 'init.rb')
18
+
19
+ require 'models.rb'
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_audited_collection
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ version: "0.3"
9
+ platform: ruby
10
+ authors:
11
+ - Shaun Mangelsdorf
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-08-25 00:00:00 +10:00
17
+ default_executable:
18
+ dependencies: []
19
+
20
+ description: |
21
+ Adds auditing capabilities to ActiveRecord associations, in a similar fashion to acts_as_audited.
22
+
23
+ email: s.mangelsdorf@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.md
30
+ files:
31
+ - uninstall.rb
32
+ - init.rb
33
+ - Rakefile
34
+ - README.md
35
+ - install.rb
36
+ - LICENSE
37
+ - generators/audited_collection_migration/USAGE
38
+ - generators/audited_collection_migration/audited_collection_migration_generator.rb
39
+ - generators/audited_collection_migration/templates/migration.rb
40
+ - lib/acts_as_audited_collection/collection_audit.rb
41
+ - lib/acts_as_audited_collection.rb
42
+ - lib/tasks/acts_as_audited_collection_tasks.rake
43
+ - rails/init.rb
44
+ - spec/models.rb
45
+ - spec/spec_helper.rb
46
+ - spec/debug.log
47
+ - spec/acts_as_audited_collection_spec.rb
48
+ - spec/db/schema.rb
49
+ - spec/db/database.yml
50
+ - spec/db/acts_as_audited_collection.sqlite3.db
51
+ has_rdoc: true
52
+ homepage: http://smangelsdorf.github.com
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ requirements: []
75
+
76
+ rubyforge_project: auditcollection
77
+ rubygems_version: 1.3.6
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: Extends ActiveRecord to allow auditing of associations
81
+ test_files: []
82
+