Reputation: 34934
I have 3 routes
POST /api/v1/items/ controllers.Application.update
POST /api/v1/items/:item_type controllers.Application.update(item_type: String)
POST /api/v1/items/:item_type/:id/ controllers.Application.update(item_type: String, id: Int)
and 3 corresponding actions for them. And one error:
[error] /my_app/conf/routes:3: method update is defined twice
[error] conflicting symbols both originated in file '/home/alex/my_app/target/scala-2.10/src_managed/main/routes_reverseRouting.scala'
[error] POST /api/v1/items/:item_type/:id/ controllers.Application.update(item_type: String, id: Int)
Please notice that should not be any default value for the parameters that is why I need these actions to be separated.
Upvotes: 1
Views: 137
Reputation: 14659
In play methods are called by name. Parameters are omitted. Name of method has to be unique. You can not have the same name for controllers (if you have in two packages)
Please use default parameters:
POST /api/v1/items/ controllers.Application.update(item_type: String = "", id: Int = 0)
POST /api/v1/items/:item_type controllers.Application.update(item_type: String, id Int =0)
POST /api/v1/items/:item_type/:id/ controllers.Application.update(item_type: String, id: Int)
Upvotes: 1