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

only warn logger if present #905

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/paper_trail/record_trail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def log_version_errors(version, action)
version.logger.warn(
"Unable to create version for #{action} of #{@record.class.name}" +
"##{@record.id}: " + version.errors.full_messages.join(", ")
)
) if version.logger
end

# Returns true if the given HABTM association should be saved.
Expand Down
2 changes: 1 addition & 1 deletion lib/paper_trail/reifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def reify_attributes(model, version, attrs)
model[k.to_sym] = v
elsif model.respond_to?("#{k}=")
model.send("#{k}=", v)
else
elsif version.logger
version.logger.warn(
"Attribute #{k} does not exist on #{version.item_type} (Version id: #{version.id})."
)
Expand Down