palkan / logidze

Database changes log for Rails
MIT License
1.59k stars 74 forks source link

Responsibility tracking integration for console sessions #200

Closed nickbender closed 3 years ago

nickbender commented 3 years ago

Feature Request

At current, responsibility_id gets assigned by wrapping any command with a block, which works great in situations like controllers or operations that can be dealt with in lifecycles, but this makes wrapping an entire console session in production a bit more cumbersome.

While I'm open to suggestions on how best to wrap console with the Logidze.with_responsible block, that would require a bit more hacking than feels appropraite.

Is there another sane way to add default or fallback responsibility_id tracking for all actions that might happen in a rails console session?

palkan commented 3 years ago

Is there another sane way to add default or fallback responsibility_id tracking for all actions that might happen in a rails console session?

I think, we can use config.console block here (https://guides.rubyonrails.org/configuring.html#rails-general-configuration) like this:

console do
  Logidze.with_responsible!(current_user.id)
end

The only problem is that we don't have a block-less version yet 🙂. Would you like to work on this feature?)

palkan commented 3 years ago

Closed in favor of #202