Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

where to you place "set_papertrail_user(user)"? #2

Closed
jcavalieri opened this issue Apr 16, 2015 · 2 comments
Closed

where to you place "set_papertrail_user(user)"? #2

jcavalieri opened this issue Apr 16, 2015 · 2 comments

Comments

@jcavalieri
Copy link

Thanks for writing this gem. It is exactly what I need. However I'm confused by the documentation. Where do you place "set_papertrail_user(user)"?

Could you stick an example that includes what file you put this in?

Thanks,
John

@sardaukar
Copy link
Owner

Here: https://github.com/sardaukar/grape-papertrail/blob/master/lib/grape/papertrail.rb

You could also have used the search box at the top of the page, to the right of the Github logo.

@jcavalieri
Copy link
Author

Sorry for the confusion, I meant where do you call that method not where is it declared.

Regardless, I found that all I needed to do was assign whodunnit in grape api's before event.

  before do
    error!('Unauthorized', 401) unless authenticate!(env, logger)

    if @api_key
      ::PaperTrail.whodunnit = @api_key.client_name
    end
  end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants