Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 90 lines (56 sloc) 3.353 kb
d948a771 »
2009-05-19 Saving audit_changes to database in a separate table instead of a hash.
1 = d5/acts_as_audited
2
3 d5/acts_as_audited is just a forked version of acts_as_audited. Instead of storing changes as a hash inside a column, an audit_changes table was made.
4
5 This also allowed for associations to be handled. See usage for more information about that.
6
c6d3ed20 »
2006-11-19 added cache_sweeper implementation for user auditing
7 = acts_as_audited
8531b195 »
2006-08-14 made Audit.changes a serialized hash
8
c6d3ed20 »
2006-11-19 added cache_sweeper implementation for user auditing
9 acts_as_audited is an ActiveRecord extension that logs all changes to your models in an audits table.
10
c8e120da »
2008-11-13 CHANGED: can now run rake spec to run specs.
11 The purpose of this fork is to store both the previous values and the changed value, making each audit record selfcontained.
12
6f0df7c0 »
2008-05-17 update README
13 == Installation
14
8f7f0601 »
2008-10-10 removes paragraph about not working in development mode from README file
15 * Install the plugin into your rails app
6f0df7c0 »
2008-05-17 update README
16 If you are using Rails 2.1:
17
e0ed8b5d »
2009-05-19 Updated README file.
18 script/plugin install git://github.com/d5/acts_as_audited.git
8f7f0601 »
2008-10-10 removes paragraph about not working in development mode from README file
19
6f0df7c0 »
2008-05-17 update README
20 For versions prior to 2.1:
21
e0ed8b5d »
2009-05-19 Updated README file.
22 git clone git://github.com/d5/acts_as_audited.git vendor/plugins/acts_as_audited
6f0df7c0 »
2008-05-17 update README
23
24 * Generate the migration
25 script/generate audited_migration add_audits_table
26 rake db:migrate
27
968540ef »
2009-03-22 A little cleanup of the implementation for passing audit options in c…
28 == Usage
c6d3ed20 »
2006-11-19 added cache_sweeper implementation for user auditing
29
30 If you're using acts_as_audited within Rails, you can simply declare which models should be audited. acts_as_audited can also automatically record the user that made the change if your controller has a <tt>current_user</tt> method.
31
32 class ApplicationController < ActionController::Base
d948a771 »
2009-05-19 Saving audit_changes to database in a separate table instead of a hash.
33 audit User, List, Item => {:except => :password, :include => [:subitems]}
c6d3ed20 »
2006-11-19 added cache_sweeper implementation for user auditing
34 protected
35 def current_user
36 @user ||= User.find(session[:user])
37 end
38 end
8f7f0601 »
2008-10-10 removes paragraph about not working in development mode from README file
39
968540ef »
2009-03-22 A little cleanup of the implementation for passing audit options in c…
40 To get auditing outside of Rails you can explicitly declare <tt>acts_as_audited</tt> on your models:
8531b195 »
2006-08-14 made Audit.changes a serialized hash
41
42 class User < ActiveRecord::Base
d948a771 »
2009-05-19 Saving audit_changes to database in a separate table instead of a hash.
43 acts_as_audited :except => [:password, :mistress], include => [:items, :lists]
8531b195 »
2006-08-14 made Audit.changes a serialized hash
44 end
45
b624ba06 »
2009-06-03 Support for thread-safe 'background auditing'
46 To record a user in the audits when the sweepers are not available, you can use <tt>as_user</tt>:
47
48 Audit.as_user( user ) do
49 # Perform changes on audited models
50 end
51
8531b195 »
2006-08-14 made Audit.changes a serialized hash
52 See http://opensoul.org/2006/07/21/acts_as_audited for more information.
53
c6d3ed20 »
2006-11-19 added cache_sweeper implementation for user auditing
54 == Caveats
8531b195 »
2006-08-14 made Audit.changes a serialized hash
55
8f7f0601 »
2008-10-10 removes paragraph about not working in development mode from README file
56 If your model declares +attr_accessible+ after +acts_as_audited+, you need to set +:protect+ to false. acts_as_audited uses +attr_protected+ internally to prevent malicious users from unassociating your audits, and Rails does not allow both +attr_protected+ and +attr_accessible+. It will default to false if +attr_accessible+ is called before +acts_as_audited+, but needs to be explicitly set if it is called after.
a799f388 »
2008-08-02 added :protect option to stop acts_as_audited from using attr_protect…
57
58 class User < ActiveRecord::Base
59 acts_as_audited :protect => false
60 attr_accessible :name
61 end
8531b195 »
2006-08-14 made Audit.changes a serialized hash
62
848e1156 »
2007-12-13 take options for audit sweeper
63 === ActiveScaffold
64
65 Many users have also reported problems with acts_as_audited and ActiveScaffold, which appears to be caused by a limitation in ActiveScaffold not supporting polymorphic associations. To get it to work with ActiveScaffold:
66
67 class ApplicationController < ActionController::Base
68 audit MyModel, :only => [:create, :update, :destroy]
69 end
70
a799f388 »
2008-08-02 added :protect option to stop acts_as_audited from using attr_protect…
71 == Compatability
a60720a3 »
2007-06-17 added revisioning support
72
04c38150 »
2009-01-25 Removed bundled dirty tracking, requiring Rails 2.1 or later
73 acts_as_audited works with Rails 2.1 or later.
1345d2aa »
2009-01-25 Added note about contributing
74
75 == Contributing
76
77 Contributions are always welcome. Checkout the latest code on GitHub:
39dc47fd »
2009-05-23 Update README about tests and reporting issues
78 http://github.com/collectiveidea/acts_as_audited
1345d2aa »
2009-01-25 Added note about contributing
79
39dc47fd »
2009-05-23 Update README about tests and reporting issues
80 Please include tests with your patches. There are a few gems required to run the tests:
81 $ gem install multi_rails
e4adb6bc »
2009-06-03 Require jnunemaker's fork of matchy
82 $ gem install thoughtbot-shoulda jnunemaker-matchy --source http://gems.github.com
39dc47fd »
2009-05-23 Update README about tests and reporting issues
83
84 Make sure the tests pass against all versions of Rails since 2.1:
85
86 $ rake test:multi_rails:all
1345d2aa »
2009-01-25 Added note about contributing
87
39dc47fd »
2009-05-23 Update README about tests and reporting issues
88 Please report bugs or feature suggestions on GitHub:
89 http://github.com/collectiveidea/acts_as_audited/issues
Something went wrong with that request. Please try again.