You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something about the way I have to append additional info to the payload (i.e. overriding append_info_to_payload inside of my ApplicationController) feels messy. It requires defining the same custom options in 2 different locations, very far apart. This is something I'd much prefer to do right next to where I configure lograge, or at least in an initializer, so that when I (or a team member) come back to this in 6 months it isn't totally confusing.
For now, I have an initializer (lograge.rb) set up that looks like this (>= ruby 2.0):
moduleLogrageControllerOverridedefappend_info_to_payload(payload)superpayload[:host]=request.hostpayload[:fwd]=request.remote_ippayload[:user_id]=current_user.try(:id)endend# should probably do this only if Rails.env is productionActionController::Base.send:prepend,LogrageControllerOverride
And then in config/environments/production.rb I have this:
But I'd still prefer to be able to do all of this from config/environments/production.rb along with the above config code. As in, specify a proc which will be called in the context of the controller, so I'd have direct access to the usual things like request and current_user. Does that make sense?
The text was updated successfully, but these errors were encountered:
If this issue is worth pursuing, I can come up with a draft and send a pull request. I've recently done something similar as part of the configuration for a gem I am working on. (Let me know if there is any interest in this.)
Something about the way I have to append additional info to the payload (i.e. overriding
append_info_to_payload
inside of myApplicationController
) feels messy. It requires defining the same custom options in 2 different locations, very far apart. This is something I'd much prefer to do right next to where I configure lograge, or at least in an initializer, so that when I (or a team member) come back to this in 6 months it isn't totally confusing.For now, I have an initializer (
lograge.rb
) set up that looks like this (>= ruby 2.0):And then in
config/environments/production.rb
I have this:But I'd still prefer to be able to do all of this from
config/environments/production.rb
along with the above config code. As in, specify a proc which will be called in the context of the controller, so I'd have direct access to the usual things likerequest
andcurrent_user
. Does that make sense?The text was updated successfully, but these errors were encountered: