Open krystof-k opened 6 months ago
I'm not sure whether this is a target behavior but when saving new object, the tenant ID is simply overriden with the current tenant although I'd expect it to fail:
irb(main):020:0> ActsAsTenant.current_tenant = Account.find_by(name: 'first') irb(main):021:0> file = MyFile.new(account_id: Account.find_by(name: 'second').id) => #<MyFile:0x0000ffff9e54d618 account_id: "43493dde-c683-4ffd-a40d-de8801d71648", created_at: nil> irb(main):022:0> file.save TRANSACTION (0.8ms) BEGIN RawFile Create (1.3ms) INSERT INTO "my_files" ("account_id", "created_at") VALUES ($1, $2, $3) RETURNING "id" [["account_id", "a5106c5b-caf7-442b-ad1c-3e1fec36fc39"], ["created_at", "2023-12-31 18:14:16.513713"]] TRANSACTION (1.1ms) COMMIT => true
Notice the UUID submitted is overriden by the tenant UUID in the SQL query.
I'm not sure whether this is a target behavior but when saving new object, the tenant ID is simply overriden with the current tenant although I'd expect it to fail:
Notice the UUID submitted is overriden by the tenant UUID in the SQL query.