active-audit 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa8159ff95a78b6fecf5ff894ab710960a218fbf
|
|
4
|
+
data.tar.gz: f966c8327ddaaf055b640ad82193ec45420f848c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3f737364853708a070513a85d09adbb333ff3eb0a888aa41df2fad8595d88a13d35c6ed76736b75d64a9736e0780211d78dc07ffcb55200bed7f7c0734be4c5
|
|
7
|
+
data.tar.gz: 341f2312ce6f80c4b589d5a0886039722b03d3e7493906278ba9cfa7c189bdc0bf2977a56a071d57b8e3d82e937fc20c9d8aec00c5dd5f46e55f3afeb4342d1f
|
|
@@ -12,9 +12,7 @@ module ActiveAudit
|
|
|
12
12
|
through_id = reflection.foreign_key
|
|
13
13
|
through_name = through_refl.name
|
|
14
14
|
define_association_method_suffix association_name
|
|
15
|
-
ActiveRecord::Associations::Builder::CollectionAssociation.define_callback(self, :
|
|
16
|
-
puts "addubng"
|
|
17
|
-
puts relation.attributes
|
|
15
|
+
ActiveRecord::Associations::Builder::CollectionAssociation.define_callback(self, :before_add, through_name, before_add: lambda do |model, relation|
|
|
18
16
|
DirtyAssociation.record_add association_name, model, relation, through_name, through_id
|
|
19
17
|
end)
|
|
20
18
|
ActiveRecord::Associations::Builder::CollectionAssociation.define_callback(self, :before_remove, through_name, before_remove: lambda do |model, relation|
|
|
@@ -8,17 +8,14 @@ module ActiveAudit
|
|
|
8
8
|
|
|
9
9
|
desc "Create initializer and config files for active audit base on the adapter you define. In case of 'active_record' adapter a migration will be generated as well."
|
|
10
10
|
|
|
11
|
-
argument :adapter, required: true, type: :string, desc: "The name of the storage adapter you want to use.",
|
|
11
|
+
argument :adapter, required: true, type: :string, default: "test", desc: "The name of the storage adapter you want to use.",
|
|
12
12
|
:banner => "adapter_name"
|
|
13
13
|
|
|
14
14
|
source_root File.expand_path("../templates", __FILE__)
|
|
15
15
|
|
|
16
16
|
def copy_initializer_file
|
|
17
17
|
template "initializer.rb", "config/initializers/active_audit.rb"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def copy_config_file
|
|
21
|
-
unless adapter == 'active_record'
|
|
18
|
+
unless adapter == 'active_record' || adapter == 'test'
|
|
22
19
|
copy_file "#{adapter}_config.yml", "config/active_audit.yml"
|
|
23
20
|
end
|
|
24
21
|
end
|