Skip to content

Commit

Permalink
Update CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 authored Jan 11, 2024
1 parent 599d8af commit 7e3bd8a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Unreleased
----------

* Add `config.tenant_change_hook` callback when a tenant changes. [#333](https://github.com/ErwinM/acts_as_tenant/pull/333)

This can be used to implement Postgres's row-level security for example

```ruby
ActsAsTenant.configure do |config|
config.tenant_change_hook = lambda do |tenant|
if tenant.present?
ActiveRecord::Base.connection.execute(ActiveRecord::Base.sanitize_sql_array(["SET rls.account_id = ?;", tenant.id]))
Rails.logger.info "Changed tenant to " + [tenant.id, tenant.name].to_json
end
end
end
```

1.0.1
-----

Expand Down

0 comments on commit 7e3bd8a

Please sign in to comment.