Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize options on initialization and minor cleanup #397

Merged
merged 1 commit into from
Jan 9, 2018

Conversation

tbrisker
Copy link
Collaborator

@tbrisker tbrisker commented Jan 7, 2018

Normalizing options passed on audited initialization simplifies code in
further steps. Also cleaned up the code a bit.

def normalize_audited_options
audited_options[:on] = Array.wrap(audited_options[:on])
audited_options[:on] = [:create, :update, :destroy] if audited_options[:on].empty?
audited_options[:only] = Array.wrap(audited_options[:only]).map(&:to_s) if audited_options[:only]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to keep audited_options[:only]==nil if it wasn't specified since we use it to determine which columns to save.

Normalizing options passed on audited initialization simplifies code in
further steps. Also cleaned up the code a bit.
@tbrisker tbrisker merged commit 8f8495d into collectiveidea:master Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant