我有3條路線重寫方法似乎不起作用
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)
和3其對應的動作。而一個錯誤:
[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)
請注意,不應該是參數的任何缺省值,這就是爲什麼我需要分開這些行動。
你能使用不同的名稱爲您'update'方法是什麼?我認爲問題來自於不喜歡重載方法。 – tehlexx