README.md in velocity_audited-5.1.4 vs README.md in velocity_audited-5.1.5

- old
+ new

@@ -40,14 +40,14 @@ ``` And if you're using ```require: false``` you must add initializers like this: ```ruby -#./config/initializers/audited.rb -require "audited" +#./config/initializers/velocity_audited.rb +require "velocity_audited" -Audited::Railtie.initializers.each(&:run) +VelocityAudited::Railtie.initializers.each(&:run) ``` Then, from your Rails app directory, create the `audits` table: ```bash @@ -172,11 +172,11 @@ ### Limiting stored audits You can limit the number of audits stored for your model. To configure limiting for all audited models, put the following in an initializer file (`config/initializers/audited.rb`): ```ruby -Audited.max_audits = 10 # keep only 10 latest audits +VelocityAudited.max_audits = 10 # keep only 10 latest audits ``` or customize per model: ```ruby @@ -211,17 +211,17 @@ ``` To use a method other than `current_user`, put the following in an initializer file (`config/initializers/audited.rb`): ```ruby -Audited.current_user_method = :authenticated_user +VelocityAudited.current_user_method = :authenticated_user ``` Outside of a request, Audited can still record the user with the `as_user` method: ```ruby -Audited.audit_class.as_user(User.find(1)) do +VelocityAudited.audit_class.as_user(User.find(1)) do post.update!(title: "Hello, world!") end post.audits.last.user # => #<User id: 1> ``` @@ -244,24 +244,24 @@ ``` `as_user` also accepts a string, which can be useful for auditing updates made in a CLI environment: ```rb -Audited.audit_class.as_user("console-user-#{ENV['SSH_USER']}") do +VelocityAudited.audit_class.as_user("console-user-#{ENV['SSH_USER']}") do post.update_attributes!(title: "Hello, world!") end post.audits.last.user # => 'console-user-username' ``` If you want to set a specific user as the auditor of the commands in a CLI environment, whether that is a string or an ActiveRecord object, you can use the following command: ```rb -Audited.store[:audited_user] = "username" +VelocityAudited.store[:audited_user] = "username" # or -Audited.store[:audited_user] = User.find(1) +VelocityAudited.store[:audited_user] = User.find(1) ``` ### Associated Audits Sometimes it's useful to associate an audit with a model other than the one being changed. For instance, given the following models: @@ -364,11 +364,11 @@ ``` To disable auditing on all models: ```ruby -Audited.auditing_enabled = false +VelocityAudited.auditing_enabled = false ``` If you have auditing disabled by default on your model you can enable auditing temporarily. @@ -388,33 +388,35 @@ ### Custom `Audit` model If you want to extend or modify the audit model, create a new class that inherits from `Audited::Audit`: + ```ruby -class CustomAudit < Audited::Audit +class CustomAudit < VelocityAudited::Audit def some_custom_behavior "Hiya!" end end ``` Then set it in an initializer: + ```ruby -# config/initializers/audited.rb +# config/initializers/velocity_audited.rb -Audited.config do |config| +VelocityAudited.config do |config| config.audit_class = CustomAudit end ``` ### Enum Storage In 4.10, the default behavior for enums changed from storing the value synthesized by Rails to the value stored in the DB. You can restore the previous behavior by setting the store_synthesized_enums configuration value: ```ruby -# config/initializers/audited.rb +# config/initializers/velocity_audited.rb -Audited.store_synthesized_enums = true +VelocityAudited.store_synthesized_enums = true ``` ## Support You can find documentation at: http://rdoc.info/github/collectiveidea/audited