Hello,
I started using the gem considering the Rails problem with uniqueness and accepts_nested_attributes_for, but I'm having a problem that I'm not sure it's a gem limitation or a implementation error of mine.
I have these relationships/models:
classTeam < ApplicationRecordhas_many:requested_units,index_errors: trueaccepts_nested_attributes_for:requested_unitsend
classRequestedUnit < ApplicationRecordbelongs_to:teamvalidates_db_uniqueness_of:code,index_name: 'IX_REQ_UNIT_CODE',scope: %i[team_id],rescue: :alwaysend
I think the uniqueness itself works well since the log shows an rollback (ROLLBACK TO SAVEPOINT active_record_1), but when doing @team.errors, there is no errors to be displayed, and the object is stated as valid.
3.2.2:020 > team=Team.new(requested_units_attributes: [{code: 111},{code: 111}])=>#<Team:0x00007f7c5c1bf500 id: nil, name: "Test">3.2.2:021 > team.valid?=>false3.2.2:022 > team.errors=>#<ActiveModel::Errors []>Rails version: 7.0.7
Ruby version: 3.2.2
Hello,
I started using the gem considering the Rails problem with uniqueness and
accepts_nested_attributes_for, but I'm having a problem that I'm not sure it's a gem limitation or a implementation error of mine.I have these relationships/models:
I think the uniqueness itself works well since the log shows an rollback (
ROLLBACK TO SAVEPOINT active_record_1), but when doing@team.errors, there is no errors to be displayed, and the object is stated asvalid.Rails version: 7.0.7
Ruby version: 3.2.2