-
Does Logidze offer the ability to conditionally enable logging in a similar manner to how the Audited gem does?: class User < ActiveRecord::Base
audited if: :active?
def active?
last_login > 6.months.ago
end
end For my specific case, I don't need the conditional logic to be in the app. My model is using Rails's STI, so I have a |
Beta Was this translation helpful? Give feedback.
Answered by
palkan
Jul 16, 2024
Replies: 1 comment 1 reply
-
Since Logidze operates at the database-level, we cannot provide a similar model-backed feature. In your case, you may consider changing the trigger code a bit to include the type filter: CREATE TRIGGER logidze_on_posts
BEFORE UPDATE OR INSERT ON posts FOR EACH ROW
WHEN (coalesce(current_setting('logidze.disabled', true), '') <> 'on') AND
(NEW.type = 'audited_type')
EXECUTE PROCEDURE logidze_logger(<logidze params>); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wiegand
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since Logidze operates at the database-level, we cannot provide a similar model-backed feature. In your case, you may consider changing the trigger code a bit to include the type filter: