Take an action which use as route path.
Take an action which use as route path. ANd excluded arguments, when excluded is present, then form transform to Map[String, Any], otherwise create a new Model instance.
- your controller
- you model
use as route and as method for controller
excluded arguments
Route
case class Model(id: Int, title: Option[String] = None) trait HttpFormController extends BaseController { import HttpService._
def post(m: Model10) = { //got a Model(10, Some("spray")) }
def another(m: Map[String, Any]) = { //got a Map("title" -> "spray") } }
postForm[HttpFormController, Model10]("another", "id") ~ postForm[HttpFormController, Model10]("post" ~> "post") Post("/another", FormData(Seq("title" -> "spray"))) Post("/post", FormData(Seq("id" -> "10", "title" -> "spray")))
Base trait, which add form to model serialization