Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix #1017

  • Loading branch information...
commit 542f5d8df7030911dce96764c4b2d89567baec07 1 parent c2c4358
@nafg nafg authored
View
3  persistence/mapper/src/main/scala/net/liftweb/mapper/ManyToMany.scala
@@ -39,8 +39,7 @@ trait ManyToMany extends BaseKeyedMapper {
* If they are all successful returns true.
*/
abstract override def save = {
- super.save &&
- manyToManyFields.forall(_.save)
+ manyToManyFields.forall(_.save) && super.save
}
/**
View
28 persistence/mapper/src/test/scala/net/liftweb/mapper/ManyToManySpecs.scala
@@ -86,6 +86,34 @@ object ManyToManySpec extends Specification("ManyToMany Specification") {
person.companies += company
person.companies.length must_== 1
}
+// "count unsaved children of a saved entity" in {
+// setupDB
+// val person = new Person
+// val company = new Company
+// person.companies += company
+// person.save
+// person.companies.length must_== 1
+// }
+ "count saved children of a saved entity" in {
+ setupDB
+ val person = new Person
+ val company = new Company
+ company.save
+ person.companies += company
+ person.save
+ person.companies.length must_== 1
+ }
+ "count saved children of a saved entity after refresh" in {
+ setupDB
+ val person = new Person
+ person.save
+ val company = new Company
+ company.save
+ person.companies += company
+ person.save
+ person.companies.refresh
+ person.companies.length must_== 1
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.