audited 3.0.0 → 4.0.0.rc1
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 +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +4 -10
- data/Appraisals +6 -8
- data/README.md +82 -10
- data/Rakefile +4 -2
- data/gemfiles/rails40.gemfile +8 -0
- data/gemfiles/rails41.gemfile +8 -0
- data/lib/audited.rb +8 -1
- data/lib/audited/audit.rb +2 -6
- data/lib/audited/auditor.rb +0 -12
- data/lib/audited/rspec_matchers.rb +173 -0
- data/lib/audited/sweeper.rb +22 -3
- data/spec/rails_app/config/application.rb +3 -0
- data/spec/rails_app/config/environments/development.rb +3 -1
- data/spec/rails_app/config/environments/production.rb +2 -0
- data/spec/rails_app/config/environments/test.rb +3 -1
- data/spec/rails_app/config/initializers/secret_token.rb +1 -0
- data/spec/rails_app/config/routes.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/active_record/models.rb +1 -0
- metadata +55 -65
- data/audited-activerecord.gemspec +0 -19
- data/audited-mongo_mapper.gemspec +0 -19
- data/audited.gemspec +0 -25
- data/gemfiles/rails30.gemfile +0 -7
- data/gemfiles/rails31.gemfile +0 -7
- data/gemfiles/rails32.gemfile +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 982f38135cfff168133e5d215dfaffaa33ea8a11
|
4
|
+
data.tar.gz: 406ab4c30bfa68a2637ab095b98ebb4ebe6b3df6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6467f9860583086e452163cc4c99e4fcc5052a38877a8fbe909834840e5ad3016044de7b77dd44526536bb6aee4653b9cb359a1bed4affaffe2002945c9bef62
|
7
|
+
data.tar.gz: dfbd48f76b0493e07ba436621212864e0dc62f21e0c5f4c3d635052e285cd14d590266756af44673cc1dd999804e9891106ab555aeffbb6d2667f5a6de046ffc
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
services: mongodb
|
3
3
|
rvm:
|
4
|
-
- 1.8.7
|
5
|
-
- 1.9.2
|
6
4
|
- 1.9.3
|
7
|
-
-
|
8
|
-
|
9
|
-
only:
|
10
|
-
- master
|
11
|
-
- v3
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1.2
|
12
7
|
gemfile:
|
13
|
-
- gemfiles/
|
14
|
-
- gemfiles/
|
15
|
-
- gemfiles/rails32.gemfile
|
8
|
+
- gemfiles/rails40.gemfile
|
9
|
+
- gemfiles/rails41.gemfile
|
data/Appraisals
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
appraise '
|
2
|
-
gem 'rails', '~>
|
1
|
+
appraise 'rails40' do
|
2
|
+
gem 'rails', '~> 4.0.0'
|
3
|
+
gem 'rails-observers'
|
3
4
|
end
|
4
5
|
|
5
|
-
appraise '
|
6
|
-
gem 'rails', '~>
|
7
|
-
|
8
|
-
|
9
|
-
appraise 'rails32' do
|
10
|
-
gem 'rails', '~> 3.2.0'
|
6
|
+
appraise 'rails41' do
|
7
|
+
gem 'rails', '~> 4.1.0'
|
8
|
+
gem 'rails-observers'
|
11
9
|
end
|
data/README.md
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
Audited [](http://travis-ci.org/collectiveidea/audited) [](https://gemnasium.com/collectiveidea/audited)
|
1
|
+
Audited [](http://travis-ci.org/collectiveidea/audited) [](https://gemnasium.com/collectiveidea/audited)[](https://codeclimate.com/github/collectiveidea/audited)
|
2
2
|
=======
|
3
3
|
|
4
|
-
**Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited also allows you to record who made those changes, save comments and associate models related to the changes.
|
4
|
+
**Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited also allows you to record who made those changes, save comments and associate models related to the changes.
|
5
|
+
|
6
|
+
Audited currently (4.x release candidate) works with Rails 4. For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).
|
5
7
|
|
6
8
|
## Supported Rubies
|
7
9
|
|
8
10
|
Audited supports and is [tested against](http://travis-ci.org/collectiveidea/audited) the following Ruby versions:
|
9
11
|
|
10
|
-
* 1.8.7
|
11
|
-
* 1.9.2
|
12
12
|
* 1.9.3
|
13
|
-
*
|
13
|
+
* 2.0.0
|
14
|
+
* 2.1.2
|
14
15
|
|
15
16
|
Audited may work just fine with a Ruby version not listed above, but we can't guarantee that it will. If you'd like to maintain a Ruby that isn't listed, please let us know with a [pull request](https://github.com/collectiveidea/audited/pulls).
|
16
17
|
|
@@ -30,7 +31,7 @@ The installation process depends on what ORM your app is using.
|
|
30
31
|
Add the appropriate gem to your Gemfile:
|
31
32
|
|
32
33
|
```ruby
|
33
|
-
gem "audited-activerecord", "~>
|
34
|
+
gem "audited-activerecord", "~> 4.0"
|
34
35
|
```
|
35
36
|
|
36
37
|
Then, from your Rails app directory, create the `audits` table:
|
@@ -54,7 +55,7 @@ Upgrading will only make changes if changes are needed.
|
|
54
55
|
### MongoMapper
|
55
56
|
|
56
57
|
```ruby
|
57
|
-
gem "audited-mongo_mapper", "~>
|
58
|
+
gem "audited-mongo_mapper", "~> 4.0"
|
58
59
|
```
|
59
60
|
|
60
61
|
## Usage
|
@@ -87,6 +88,40 @@ audit.action # => "update"
|
|
87
88
|
audit.audited_changes # => {"name"=>["Steve", "Ryan"]}
|
88
89
|
```
|
89
90
|
|
91
|
+
### Specifying columns
|
92
|
+
|
93
|
+
By default, a new audit is created for any attribute changes. You can, however, limit the columns to be considered.
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
class User < ActiveRecord::Base
|
97
|
+
# All fields
|
98
|
+
# audited
|
99
|
+
|
100
|
+
# Single field
|
101
|
+
# audited only: :name
|
102
|
+
|
103
|
+
# Multiple fields
|
104
|
+
# audited only: [:name, :address]
|
105
|
+
|
106
|
+
# All except certain fields
|
107
|
+
# audited except: :password
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
111
|
+
### Specifying callbacks
|
112
|
+
|
113
|
+
By default, a new audit is created for any Create, Update or Destroy action. You can, however, limit the actions audited.
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
class User < ActiveRecord::Base
|
117
|
+
# All fields and actions
|
118
|
+
# audited
|
119
|
+
|
120
|
+
# Single field, only audit Update and Destroy (not Create)
|
121
|
+
# audited only: :name, on: [:update, :destroy]
|
122
|
+
end
|
123
|
+
```
|
124
|
+
|
90
125
|
### Comments
|
91
126
|
|
92
127
|
You can attach comments to each audit using an `audit_comment` attribute on your model.
|
@@ -172,13 +207,48 @@ user.audits.last.associated # => #<Company name: "Collective Idea">
|
|
172
207
|
company.associated_audits.last.auditable # => #<User name: "Steve Richert">
|
173
208
|
```
|
174
209
|
|
210
|
+
### Disabling auditing
|
211
|
+
|
212
|
+
If you want to disable auditing temporarily doing certain tasks, there are a few
|
213
|
+
methods available.
|
214
|
+
|
215
|
+
To disable auditing on a save:
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
@user.save_without_auditing
|
219
|
+
```
|
220
|
+
|
221
|
+
or:
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
@user.without_auditing do
|
225
|
+
@user.save
|
226
|
+
end
|
227
|
+
```
|
228
|
+
|
229
|
+
To disable auditing on a column:
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
User.non_audited_columns = [:first_name, :last_name]
|
233
|
+
```
|
234
|
+
|
235
|
+
To disable auditing on an entire model:
|
236
|
+
|
237
|
+
```ruby
|
238
|
+
User.auditing_enabled = false
|
239
|
+
```
|
240
|
+
|
175
241
|
## Gotchas
|
176
242
|
|
177
|
-
###
|
243
|
+
### Using attr_protected or strong_parameters
|
178
244
|
|
179
|
-
Audited assumes you are using `attr_accessible
|
245
|
+
Audited assumes you are using `attr_accessible`. If you're using
|
246
|
+
`attr_protected` or `strong_parameters`, you'll have to take an extra step or
|
247
|
+
two.
|
180
248
|
|
181
|
-
|
249
|
+
|
250
|
+
If you're using `strong_parameters` with Rails 3.x, be sure to add `:allow_mass_assignment => true` to your `audited` call; otherwise Audited will
|
251
|
+
interfere with `strong_parameters` and none of your `save` calls will work.
|
182
252
|
|
183
253
|
```ruby
|
184
254
|
class User < ActiveRecord::Base
|
@@ -186,6 +256,8 @@ class User < ActiveRecord::Base
|
|
186
256
|
end
|
187
257
|
```
|
188
258
|
|
259
|
+
If using `attr_protected`, add `:allow_mass_assignment => true`, and also be sure to add `audit_ids` to the list of protected attributes to prevent data loss.
|
260
|
+
|
189
261
|
```ruby
|
190
262
|
class User < ActiveRecord::Base
|
191
263
|
audited :allow_mass_assignment => true
|
data/Rakefile
CHANGED
@@ -17,8 +17,10 @@ ADAPTERS.each do |adapter|
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
task :spec do
|
21
|
+
ADAPTERS.each do |adapter|
|
22
|
+
Rake::Task[adapter].invoke
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
26
|
task :default => :spec
|
data/lib/audited.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
require 'rails/observers/active_model/active_model'
|
2
|
+
|
3
|
+
|
1
4
|
module Audited
|
2
|
-
VERSION = '
|
5
|
+
VERSION = '4.0.0'
|
3
6
|
|
4
7
|
class << self
|
5
8
|
attr_accessor :ignored_attributes, :current_user_method, :audit_class
|
9
|
+
|
10
|
+
def store
|
11
|
+
Thread.current[:audited_store] ||= {}
|
12
|
+
end
|
6
13
|
end
|
7
14
|
|
8
15
|
@ignored_attributes = %w(lock_version created_at updated_at created_on updated_on)
|
data/lib/audited/audit.rb
CHANGED
@@ -16,7 +16,6 @@ module Audited
|
|
16
16
|
cattr_accessor :audited_class_names
|
17
17
|
self.audited_class_names = Set.new
|
18
18
|
|
19
|
-
attr_accessible :action, :audited_changes, :comment, :associated
|
20
19
|
end
|
21
20
|
|
22
21
|
# Returns the list of classes that are being audited
|
@@ -29,12 +28,9 @@ module Audited
|
|
29
28
|
# for background operations that require audit information.
|
30
29
|
def as_user(user, &block)
|
31
30
|
Thread.current[:audited_user] = user
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
yield
|
32
|
+
ensure
|
35
33
|
Thread.current[:audited_user] = nil
|
36
|
-
|
37
|
-
yieldval
|
38
34
|
end
|
39
35
|
|
40
36
|
# @private
|
data/lib/audited/auditor.rb
CHANGED
@@ -30,19 +30,10 @@ module Audited
|
|
30
30
|
# class User < ActiveRecord::Base
|
31
31
|
# audited :except => :password
|
32
32
|
# end
|
33
|
-
# * +protect+ - If your model uses +attr_protected+, set this to false to prevent Rails from
|
34
|
-
# raising an error. If you declare +attr_accessible+ before calling +audited+, it
|
35
|
-
# will automatically default to false. You only need to explicitly set this if you are
|
36
|
-
# calling +attr_accessible+ after.
|
37
33
|
#
|
38
34
|
# * +require_comment+ - Ensures that audit_comment is supplied before
|
39
35
|
# any create, update or destroy operation.
|
40
36
|
#
|
41
|
-
# class User < ActiveRecord::Base
|
42
|
-
# audited :protect => false
|
43
|
-
# attr_accessible :name
|
44
|
-
# end
|
45
|
-
#
|
46
37
|
def audited(options = {})
|
47
38
|
# don't allow multiple calls
|
48
39
|
return if self.included_modules.include?(Audited::Auditor::AuditedInstanceMethods)
|
@@ -66,9 +57,6 @@ module Audited
|
|
66
57
|
end
|
67
58
|
|
68
59
|
attr_accessor :audit_comment
|
69
|
-
unless options[:allow_mass_assignment]
|
70
|
-
attr_accessible :audit_comment
|
71
|
-
end
|
72
60
|
|
73
61
|
has_many :audits, :as => :auditable, :class_name => Audited.audit_class.name
|
74
62
|
Audited.audit_class.audited_class_names << self.to_s
|
@@ -0,0 +1,173 @@
|
|
1
|
+
module Audited
|
2
|
+
module RspecMatchers
|
3
|
+
# Ensure that the model is audited.
|
4
|
+
#
|
5
|
+
# Options:
|
6
|
+
# * <tt>associated_with</tt> - tests that the audit makes use of the associated_with option
|
7
|
+
# * <tt>only</tt> - tests that the audit makes use of the only option *Overrides <tt>except</tt> option*
|
8
|
+
# * <tt>except</tt> - tests that the audit makes use of the except option
|
9
|
+
# * <tt>requires_comment</tt> - if specified, then the audit must require comments through the <tt>audit_comment</tt> attribute
|
10
|
+
# * <tt>on</tt> - tests that the audit makes use of the on option with specified parameters
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
# it { should be_audited }
|
14
|
+
# it { should be_audited.associated_with(:user) }
|
15
|
+
# it { should be_audited.only(:field_name) }
|
16
|
+
# it { should be_audited.except(:password) }
|
17
|
+
# it { should be_audited.requires_comment }
|
18
|
+
# it { should be_audited.on(:create).associated_with(:user).except(:password) }
|
19
|
+
#
|
20
|
+
def be_audited
|
21
|
+
AuditMatcher.new
|
22
|
+
end
|
23
|
+
|
24
|
+
# Ensure that the model has associated audits
|
25
|
+
#
|
26
|
+
# Example:
|
27
|
+
# it { should have_associated_audits }
|
28
|
+
#
|
29
|
+
def have_associated_audits
|
30
|
+
AssociatedAuditMatcher.new
|
31
|
+
end
|
32
|
+
|
33
|
+
class AuditMatcher # :nodoc:
|
34
|
+
def initialize
|
35
|
+
@options = {}
|
36
|
+
end
|
37
|
+
|
38
|
+
def associated_with(model)
|
39
|
+
@options[:associated_with] = model
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
43
|
+
def only(*fields)
|
44
|
+
@options[:only] = fields.flatten
|
45
|
+
self
|
46
|
+
end
|
47
|
+
|
48
|
+
def except(*fields)
|
49
|
+
@options[:except] = fields.flatten
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
def requires_comment
|
54
|
+
@options[:comment_required] = true
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def on(*actions)
|
59
|
+
@options[:on] = actions.flatten
|
60
|
+
self
|
61
|
+
end
|
62
|
+
|
63
|
+
def matches?(subject)
|
64
|
+
@subject = subject
|
65
|
+
auditing_enabled? &&
|
66
|
+
associated_with_model? &&
|
67
|
+
records_changes_to_specified_fields? &&
|
68
|
+
comment_required_valid?
|
69
|
+
end
|
70
|
+
|
71
|
+
def failure_message
|
72
|
+
"Expected #{@expectation}"
|
73
|
+
end
|
74
|
+
|
75
|
+
def negative_failure_message
|
76
|
+
"Did not expect #{@expectation}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def description
|
80
|
+
description = "audited"
|
81
|
+
description += " associated with #{@options[:associated_with]}" if @options.key?(:associated_with)
|
82
|
+
description += " only => #{@options[:only].join ', '}" if @options.key?(:only)
|
83
|
+
description += " except => #{@options[:except].join(', ')}" if @options.key?(:except)
|
84
|
+
description += " requires audit_comment" if @options.key?(:comment_required)
|
85
|
+
|
86
|
+
description
|
87
|
+
end
|
88
|
+
|
89
|
+
protected
|
90
|
+
|
91
|
+
def expects(message)
|
92
|
+
@expectation = message
|
93
|
+
end
|
94
|
+
|
95
|
+
def auditing_enabled?
|
96
|
+
expects "#{model_class} to be audited"
|
97
|
+
model_class.respond_to?(:auditing_enabled) && model_class.auditing_enabled
|
98
|
+
end
|
99
|
+
|
100
|
+
def model_class
|
101
|
+
@subject.class
|
102
|
+
end
|
103
|
+
|
104
|
+
def associated_with_model?
|
105
|
+
expects "#{model_class} to record audits to associated model #{@options[:associated_with]}"
|
106
|
+
model_class.audit_associated_with == @options[:associated_with]
|
107
|
+
end
|
108
|
+
|
109
|
+
def records_changes_to_specified_fields?
|
110
|
+
if @options[:only] || @options[:except]
|
111
|
+
if @options[:only]
|
112
|
+
except = model_class.column_names - @options[:only].map(&:to_s)
|
113
|
+
else
|
114
|
+
except = model_class.default_ignored_attributes + Audited.ignored_attributes
|
115
|
+
except |= @options[:except].collect(&:to_s) if @options[:except]
|
116
|
+
end
|
117
|
+
|
118
|
+
expects "non audited columns (#{model_class.non_audited_columns.inspect}) to match (#{expect})"
|
119
|
+
model_class.non_audited_columns =~ except
|
120
|
+
else
|
121
|
+
true
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def comment_required_valid?
|
126
|
+
if @options[:comment_required]
|
127
|
+
@subject.audit_comment = nil
|
128
|
+
|
129
|
+
expects "to be invalid when audit_comment is not specified"
|
130
|
+
@subject.valid? == false && @subject.errors.key?(:audit_comment)
|
131
|
+
else
|
132
|
+
true
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
class AssociatedAuditMatcher # :nodoc:
|
138
|
+
def matches?(subject)
|
139
|
+
@subject = subject
|
140
|
+
|
141
|
+
association_exists?
|
142
|
+
end
|
143
|
+
|
144
|
+
def failure_message
|
145
|
+
"Expected #{model_class} to have associated audits"
|
146
|
+
end
|
147
|
+
|
148
|
+
def negative_failure_message
|
149
|
+
"Expected #{model_class} to not have associated audits"
|
150
|
+
end
|
151
|
+
|
152
|
+
def description
|
153
|
+
"has associated audits"
|
154
|
+
end
|
155
|
+
|
156
|
+
protected
|
157
|
+
|
158
|
+
def model_class
|
159
|
+
@subject.class
|
160
|
+
end
|
161
|
+
|
162
|
+
def reflection
|
163
|
+
model_class.reflect_on_association(:associated_audits)
|
164
|
+
end
|
165
|
+
|
166
|
+
def association_exists?
|
167
|
+
(!reflection.nil?) &&
|
168
|
+
reflection.macro == :has_many &&
|
169
|
+
reflection.options[:class_name] == Audited.audit_class.name
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
data/lib/audited/sweeper.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
require "rails/observers/activerecord/active_record"
|
2
|
+
require "rails/observers/action_controller/caching"
|
3
|
+
|
1
4
|
module Audited
|
2
|
-
class Sweeper <
|
5
|
+
class Sweeper < ActionController::Caching::Sweeper
|
3
6
|
observe Audited.audit_class
|
4
7
|
|
5
8
|
attr_accessor :controller
|
6
|
-
|
7
9
|
def before(controller)
|
8
10
|
self.controller = controller
|
9
11
|
true
|
@@ -35,11 +37,28 @@ module Audited
|
|
35
37
|
end
|
36
38
|
klass.send(:before_create, callback_meth)
|
37
39
|
end
|
40
|
+
|
41
|
+
def controller
|
42
|
+
::Audited.store[:current_controller]
|
43
|
+
end
|
44
|
+
|
45
|
+
def controller=(value)
|
46
|
+
::Audited.store[:current_controller] = value
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
40
50
|
|
41
51
|
if defined?(ActionController) and defined?(ActionController::Base)
|
52
|
+
# Create dynamic subclass of Audited::Sweeper otherwise rspec will
|
53
|
+
# fail with both ActiveRecord and MongoMapper tests as there will be
|
54
|
+
# around_filter collision
|
55
|
+
sweeper_class = Class.new(Audited::Sweeper) do
|
56
|
+
def self.name
|
57
|
+
"#{Audited.audit_class}::Sweeper"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
42
61
|
ActionController::Base.class_eval do
|
43
|
-
around_filter
|
62
|
+
around_filter sweeper_class.instance
|
44
63
|
end
|
45
64
|
end
|
@@ -7,7 +7,7 @@ RailsApp::Application.configure do
|
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
9
|
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
10
|
+
# config.whiny_nils = true
|
11
11
|
|
12
12
|
# Show full error reports and disable caching
|
13
13
|
config.consider_all_requests_local = true
|
@@ -16,4 +16,6 @@ RailsApp::Application.configure do
|
|
16
16
|
|
17
17
|
# Don't care if the mailer can't send
|
18
18
|
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
config.eager_load = false
|
19
21
|
end
|
@@ -8,7 +8,7 @@ RailsApp::Application.configure do
|
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
11
|
+
# config.whiny_nils = true
|
12
12
|
|
13
13
|
# Show full error reports and disable caching
|
14
14
|
config.consider_all_requests_local = true
|
@@ -30,4 +30,6 @@ RailsApp::Application.configure do
|
|
30
30
|
config.action_dispatch.show_exceptions = false
|
31
31
|
|
32
32
|
config.active_support.deprecation = :stderr
|
33
|
+
|
34
|
+
config.eager_load = false
|
33
35
|
end
|
@@ -1,2 +1,3 @@
|
|
1
1
|
Rails.application.config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
|
2
2
|
Rails.application.config.session_store :cookie_store, :key => "_my_app"
|
3
|
+
Rails.application.config.secret_key_base = 'secret value'
|
@@ -2,5 +2,5 @@ Rails.application.routes.draw do
|
|
2
2
|
|
3
3
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
4
4
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
5
|
-
match ':controller(/:action(/:id(.:format)))'
|
5
|
+
match ':controller(/:action(/:id(.:format)))', via: [:get, :post, :put, :delete]
|
6
6
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audited
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.0.rc1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brandon Keepers
|
@@ -14,118 +13,118 @@ authors:
|
|
14
13
|
autorequire:
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
|
-
date:
|
16
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
18
17
|
dependencies:
|
19
18
|
- !ruby/object:Gem::Dependency
|
20
|
-
name:
|
19
|
+
name: rails-observers
|
21
20
|
requirement: !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
21
|
requirements:
|
24
|
-
- - ~>
|
22
|
+
- - "~>"
|
25
23
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
24
|
+
version: 0.1.2
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - "~>"
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.1.2
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: protected_attributes
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
27
39
|
type: :development
|
28
40
|
prerelease: false
|
29
41
|
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
42
|
requirements:
|
32
|
-
- -
|
43
|
+
- - ">="
|
33
44
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
45
|
+
version: '0'
|
35
46
|
- !ruby/object:Gem::Dependency
|
36
47
|
name: appraisal
|
37
48
|
requirement: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
49
|
requirements:
|
40
|
-
- - ~>
|
50
|
+
- - "~>"
|
41
51
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
52
|
+
version: 1.0.0
|
43
53
|
type: :development
|
44
54
|
prerelease: false
|
45
55
|
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
56
|
requirements:
|
48
|
-
- - ~>
|
57
|
+
- - "~>"
|
49
58
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
59
|
+
version: 1.0.0
|
51
60
|
- !ruby/object:Gem::Dependency
|
52
61
|
name: bson_ext
|
53
62
|
requirement: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
63
|
requirements:
|
56
|
-
- - ~>
|
64
|
+
- - "~>"
|
57
65
|
- !ruby/object:Gem::Version
|
58
66
|
version: '1.6'
|
59
67
|
type: :development
|
60
68
|
prerelease: false
|
61
69
|
version_requirements: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
70
|
requirements:
|
64
|
-
- - ~>
|
71
|
+
- - "~>"
|
65
72
|
- !ruby/object:Gem::Version
|
66
73
|
version: '1.6'
|
67
74
|
- !ruby/object:Gem::Dependency
|
68
75
|
name: mongo_mapper
|
69
76
|
requirement: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
77
|
requirements:
|
72
|
-
- - ~>
|
78
|
+
- - "~>"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
80
|
+
version: 0.13.0.beta2
|
75
81
|
type: :development
|
76
82
|
prerelease: false
|
77
83
|
version_requirements: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
84
|
requirements:
|
80
|
-
- - ~>
|
85
|
+
- - "~>"
|
81
86
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
87
|
+
version: 0.13.0.beta2
|
83
88
|
- !ruby/object:Gem::Dependency
|
84
89
|
name: rails
|
85
90
|
requirement: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
91
|
requirements:
|
88
|
-
- - ~>
|
92
|
+
- - "~>"
|
89
93
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
94
|
+
version: 4.0.0
|
91
95
|
type: :development
|
92
96
|
prerelease: false
|
93
97
|
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
98
|
requirements:
|
96
|
-
- - ~>
|
99
|
+
- - "~>"
|
97
100
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
101
|
+
version: 4.0.0
|
99
102
|
- !ruby/object:Gem::Dependency
|
100
103
|
name: rspec-rails
|
101
104
|
requirement: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
105
|
requirements:
|
104
|
-
- - ~>
|
106
|
+
- - "~>"
|
105
107
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
108
|
+
version: '3.0'
|
107
109
|
type: :development
|
108
110
|
prerelease: false
|
109
111
|
version_requirements: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
112
|
requirements:
|
112
|
-
- - ~>
|
113
|
+
- - "~>"
|
113
114
|
- !ruby/object:Gem::Version
|
114
|
-
version: '
|
115
|
+
version: '3.0'
|
115
116
|
- !ruby/object:Gem::Dependency
|
116
117
|
name: sqlite3
|
117
118
|
requirement: !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
119
|
requirements:
|
120
|
-
- - ~>
|
120
|
+
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '1.0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
126
|
requirements:
|
128
|
-
- - ~>
|
127
|
+
- - "~>"
|
129
128
|
- !ruby/object:Gem::Version
|
130
129
|
version: '1.0'
|
131
130
|
description: Log all changes to your models
|
@@ -134,24 +133,21 @@ executables: []
|
|
134
133
|
extensions: []
|
135
134
|
extra_rdoc_files: []
|
136
135
|
files:
|
137
|
-
- .gitignore
|
138
|
-
- .travis.yml
|
139
|
-
- .yardopts
|
136
|
+
- ".gitignore"
|
137
|
+
- ".travis.yml"
|
138
|
+
- ".yardopts"
|
140
139
|
- Appraisals
|
141
140
|
- CHANGELOG
|
142
141
|
- Gemfile
|
143
142
|
- LICENSE
|
144
143
|
- README.md
|
145
144
|
- Rakefile
|
146
|
-
-
|
147
|
-
-
|
148
|
-
- audited.gemspec
|
149
|
-
- gemfiles/rails30.gemfile
|
150
|
-
- gemfiles/rails31.gemfile
|
151
|
-
- gemfiles/rails32.gemfile
|
145
|
+
- gemfiles/rails40.gemfile
|
146
|
+
- gemfiles/rails41.gemfile
|
152
147
|
- lib/audited.rb
|
153
148
|
- lib/audited/audit.rb
|
154
149
|
- lib/audited/auditor.rb
|
150
|
+
- lib/audited/rspec_matchers.rb
|
155
151
|
- lib/audited/sweeper.rb
|
156
152
|
- spec/audited_spec_helpers.rb
|
157
153
|
- spec/rails_app/config/application.rb
|
@@ -178,34 +174,28 @@ files:
|
|
178
174
|
- test/test_helper.rb
|
179
175
|
- test/upgrade_generator_test.rb
|
180
176
|
homepage: https://github.com/collectiveidea/audited
|
181
|
-
licenses:
|
177
|
+
licenses:
|
178
|
+
- MIT
|
179
|
+
metadata: {}
|
182
180
|
post_install_message:
|
183
181
|
rdoc_options: []
|
184
182
|
require_paths:
|
185
183
|
- lib
|
186
184
|
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
185
|
requirements:
|
189
|
-
- -
|
186
|
+
- - ">="
|
190
187
|
- !ruby/object:Gem::Version
|
191
188
|
version: '0'
|
192
|
-
segments:
|
193
|
-
- 0
|
194
|
-
hash: -4141891456727371647
|
195
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
-
none: false
|
197
190
|
requirements:
|
198
|
-
- -
|
191
|
+
- - ">"
|
199
192
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
201
|
-
segments:
|
202
|
-
- 0
|
203
|
-
hash: -4141891456727371647
|
193
|
+
version: 1.3.1
|
204
194
|
requirements: []
|
205
195
|
rubyforge_project:
|
206
|
-
rubygems_version:
|
196
|
+
rubygems_version: 2.2.2
|
207
197
|
signing_key:
|
208
|
-
specification_version:
|
198
|
+
specification_version: 4
|
209
199
|
summary: Log all changes to your models
|
210
200
|
test_files:
|
211
201
|
- spec/audited_spec_helpers.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |gem|
|
4
|
-
gem.name = 'audited-activerecord'
|
5
|
-
gem.version = '3.0.0'
|
6
|
-
|
7
|
-
gem.authors = ['Brandon Keepers', 'Kenneth Kalmer', 'Daniel Morrison', 'Brian Ryckbost', 'Steve Richert', 'Ryan Glover']
|
8
|
-
gem.email = 'info@collectiveidea.com'
|
9
|
-
gem.description = 'Log all changes to your ActiveRecord models'
|
10
|
-
gem.summary = gem.description
|
11
|
-
gem.homepage = 'https://github.com/collectiveidea/audited'
|
12
|
-
|
13
|
-
gem.add_dependency 'audited', gem.version
|
14
|
-
gem.add_dependency 'activerecord', '~> 3.0'
|
15
|
-
|
16
|
-
gem.files = `git ls-files lib`.split($\).grep(/(active_?record|generators)/)
|
17
|
-
gem.require_paths = ['lib']
|
18
|
-
end
|
19
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |gem|
|
4
|
-
gem.name = 'audited-mongo_mapper'
|
5
|
-
gem.version = '3.0.0'
|
6
|
-
|
7
|
-
gem.authors = ['Brandon Keepers', 'Kenneth Kalmer', 'Daniel Morrison', 'Brian Ryckbost', 'Steve Richert', 'Ryan Glover']
|
8
|
-
gem.email = 'info@collectiveidea.com'
|
9
|
-
gem.description = 'Log all changes to your MongoMapper models'
|
10
|
-
gem.summary = gem.description
|
11
|
-
gem.homepage = 'https://github.com/collectiveidea/audited'
|
12
|
-
|
13
|
-
gem.add_dependency 'audited', gem.version
|
14
|
-
gem.add_dependency 'mongo_mapper', '~> 0.11'
|
15
|
-
|
16
|
-
gem.files = `git ls-files lib`.split($\).grep(/mongo_mapper/)
|
17
|
-
gem.require_paths = ['lib']
|
18
|
-
end
|
19
|
-
|
data/audited.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |gem|
|
4
|
-
gem.name = 'audited'
|
5
|
-
gem.version = '3.0.0'
|
6
|
-
|
7
|
-
gem.authors = ['Brandon Keepers', 'Kenneth Kalmer', 'Daniel Morrison', 'Brian Ryckbost', 'Steve Richert', 'Ryan Glover']
|
8
|
-
gem.email = 'info@collectiveidea.com'
|
9
|
-
gem.description = 'Log all changes to your models'
|
10
|
-
gem.summary = gem.description
|
11
|
-
gem.homepage = 'https://github.com/collectiveidea/audited'
|
12
|
-
|
13
|
-
gem.add_development_dependency 'activerecord', '~> 3.0'
|
14
|
-
gem.add_development_dependency 'appraisal', '~> 0.4'
|
15
|
-
gem.add_development_dependency 'bson_ext', '~> 1.6'
|
16
|
-
gem.add_development_dependency 'mongo_mapper', '~> 0.11'
|
17
|
-
gem.add_development_dependency 'rails', '~> 3.0'
|
18
|
-
gem.add_development_dependency 'rspec-rails', '~> 2.0'
|
19
|
-
gem.add_development_dependency 'sqlite3', '~> 1.0'
|
20
|
-
|
21
|
-
gem.files = `git ls-files`.split($\).reject{|f| f =~ /(lib\/audited\-|adapters|generators)/ }
|
22
|
-
gem.test_files = gem.files.grep(/^spec\//)
|
23
|
-
gem.require_paths = ['lib']
|
24
|
-
end
|
25
|
-
|
data/gemfiles/rails30.gemfile
DELETED
data/gemfiles/rails31.gemfile
DELETED