-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for tracking the remote address of the client causing the…
… audit (closes #10)
- Loading branch information
1 parent
ef233ad
commit 814b925
Showing
8 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
lib/generators/acts_as_audited/templates/add_remote_address_to_audits.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class <%= migration_class_name %> < ActiveRecord::Migration | ||
def self.up | ||
add_column :audits, :remote_address, :string | ||
end | ||
|
||
def self.down | ||
remove_column :audits, :remote_address | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ActiveRecord::Schema.define do | ||
create_table :audits, :force => true do |t| | ||
t.column :auditable_id, :integer | ||
t.column :auditable_type, :string | ||
t.column :user_id, :integer | ||
t.column :user_type, :string | ||
t.column :username, :string | ||
t.column :action, :string | ||
t.column :audited_changes, :text | ||
t.column :version, :integer, :default => 0 | ||
t.column :comment, :string | ||
t.column :created_at, :datetime | ||
end | ||
|
||
add_index :audits, [:auditable_id, :auditable_type], :name => 'auditable_index' | ||
add_index :audits, [:user_id, :user_type], :name => 'user_index' | ||
add_index :audits, :created_at | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters