1) .to_sql method works without acts_as_paranoid
2) Calling the .to_sql on the User model without joins works as well:
> User.all.to_s
=> "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"deleted_at\" IS NULL"
But calling .to_sql with joins on the paranoia model throws:
NoMethodError (undefined method 'relation' for #<Arel::Nodes::BindParam:0x00007f91ece6e120>)
How to reproduce:
class User < ApplicationRecord
acts_as_paranoid
end
class UserSetting < ApplicationRecord
belongs_to :user
end
UserSetting.joins(:user).to_sql
# NoMethodError (undefined method 'relation' for #<Arel::Nodes::BindParam:0x00007f91ece6e120>)
1)
.to_sql
method works withoutacts_as_paranoid
2) Calling the.to_sql
on theUser
model without joins works as well:.to_sql
with joins on the paranoia model throws:How to reproduce: