Mapper ManyToMany trait fails to save added and then deleted join #1316

Open
Tmr opened this Issue Aug 31, 2012 · 2 comments

Projects

None yet

3 participants

@Tmr
Contributor
Tmr commented Aug 31, 2012

Code of ManyToMany.save function:

    def save = {
      _joins = joins.filter { join =>
        otherFK(join)(f => f.is != f.defaultValue)
      }
      _joins foreach { thisFK(_)(_ set ManyToMany.this.primaryKeyField.is) }

      removedJoins.forall {_.delete_!} & ( // continue saving even if deleting fails
        children.forall(_.save) &&
          joins.forall(_.save)
      )
    }

if removedJoins contains join which returns _.delete_! == false while calling removedJoins.forall {_.delete_!} for example because of db_can_delete_? of join returns false (which is the case when we add and remove the join before save), then other removed joins in removedJoins, if they are after the join, will not be deleted. This is because forall method stops evaluating after first false

Owner
dpp commented Aug 31, 2012

Please do not open tickets until you've discussed an issue on the Lift mailing list. Please see http://liftweb.net/community

@dpp dpp closed this Aug 31, 2012
Contributor
Tmr commented Aug 31, 2012

Sorry for my ignorance. I've opened topic in the mailing list: https://groups.google.com/d/topic/liftweb/lC6zCxmJFjg/discussion

@nafg nafg reopened this Sep 3, 2012
@nafg nafg was assigned Sep 3, 2012
@nafg nafg was unassigned by Tmr Apr 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment