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

Fallback in user_for_paper_trail to accept current_user returning a string #346

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 7 additions & 1 deletion lib/paper_trail/frameworks/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ def self.included(base)
# Override this method in your controller to call a different
# method, e.g. `current_person`, or anything you like.
def user_for_paper_trail
current_user.try(:id) if defined?(current_user)
if defined?(current_user)
begin
current_user.try(:id)
rescue NoMethodError
current_user
end
end
end

# Returns any information about the controller or request that you
Expand Down