Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

Tmr opened this issue Aug 31, 2012 · 2 comments

Comments

@Tmr
Copy link
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

@dpp
Copy link
Member

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 as completed Aug 31, 2012
@Tmr
Copy link
Contributor Author

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
@ghost ghost assigned nafg Sep 3, 2012
@Tmr Tmr unassigned nafg Apr 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants