-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from camsys/quarter2
Develop
- Loading branch information
Showing
14 changed files
with
84 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
language: ruby | ||
rvm: | ||
- 2.5.3 | ||
services: | ||
- mysql | ||
branches: | ||
only: | ||
- master | ||
|
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,45 @@ | ||
module TransamSubAuditable | ||
#----------------------------------------------------------------------------- | ||
# | ||
# TransamSubAuditable | ||
# | ||
# If an association needs to trigger the audit, insert this mixin so parent auditable runs auditable callbacks | ||
# | ||
#----------------------------------------------------------------------------- | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
after_save :force_save_parent_asset | ||
after_destroy :force_save_parent_asset | ||
end | ||
|
||
#----------------------------------------------------------------------------- | ||
# Class Methods | ||
#----------------------------------------------------------------------------- | ||
|
||
module ClassMethods | ||
|
||
end | ||
|
||
#----------------------------------------------------------------------------- | ||
# Instance Methods | ||
#----------------------------------------------------------------------------- | ||
|
||
|
||
|
||
|
||
#----------------------------------------------------------------------------- | ||
# Protected Methods | ||
#----------------------------------------------------------------------------- | ||
protected | ||
|
||
def force_save_parent_asset | ||
# find parent | ||
parent_class_name = SystemConfigExtension.find_by(extension_name: 'TransamAuditable').class_name | ||
|
||
parent = self.send(parent_class_name.underscore) | ||
parent.check_for_audit_changes | ||
parent.update_audits | ||
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
15 changes: 15 additions & 0 deletions
15
db/data_migrations/20190313123702_add_sub_auditable_extension_asset_events.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,15 @@ | ||
class AddSubAuditableExtensionAssetEvents < ActiveRecord::DataMigration | ||
def up | ||
system_config_extensions = [{engine_name: 'audit', class_name: 'ConditionUpdateEvent', extension_name: 'TransamSubAuditable', active: true}, | ||
{engine_name: 'audit', class_name: 'ServiceStatusUpdateEvent', extension_name: 'TransamSubAuditable', active: true} | ||
] | ||
|
||
if SystemConfig.transam_module_loaded? :transit | ||
system_config_extensions << {engine_name: 'audit', class_name: 'MileageUpdateEvent', extension_name: 'TransamSubAuditable', active: true} | ||
end | ||
|
||
system_config_extensions.each do |ext| | ||
SystemConfigExtension.create!(ext) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module TransamAudit | ||
VERSION = "2.5.0" | ||
VERSION = "2.6.0" | ||
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