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

fix Auto-application warnings #605

Merged
merged 1 commit into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/basic/app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class Application @Inject() (
"color" -> text())(Dog.apply)(Dog.unapply))

def insertCat = Action.async { implicit request =>
val cat: Cat = catForm.bindFromRequest.get
val cat: Cat = catForm.bindFromRequest().get
catDao.insert(cat).map(_ => Redirect(routes.Application.index))
}

def insertDog = Action.async { implicit request =>
val dog: Dog = dogForm.bindFromRequest.get
val dog: Dog = dogForm.bindFromRequest().get
dogDao.insert(dog).map(_ => Redirect(routes.Application.index))
}
}
4 changes: 2 additions & 2 deletions samples/computer-database/app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Application @Inject() (
* @param id Id of the computer to edit
*/
def update(id: Long) = Action.async { implicit rs =>
computerForm.bindFromRequest.fold(
computerForm.bindFromRequest().fold(
formWithErrors => companiesDao.options().map(options => BadRequest(html.editForm(id, formWithErrors, options))),
computer => {
for {
Expand All @@ -89,7 +89,7 @@ class Application @Inject() (

/** Handle the 'new computer form' submission. */
def save = Action.async { implicit rs =>
computerForm.bindFromRequest.fold(
computerForm.bindFromRequest().fold(
formWithErrors => companiesDao.options().map(options => BadRequest(html.createForm(formWithErrors, options))),
computer => {
for {
Expand Down
6 changes: 3 additions & 3 deletions src/core/src/test/scala/play/api/db/slick/SlickApiSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class SlickApiSpec extends Specification {
"SlickApi.dbConfigs" should {
"return all DatabaseConfig instances for a valid configuration" in {
import SUTWithGoodConfig._
api.dbConfigs[BasicProfile] must have size 4
api.dbConfigs[BasicProfile]() must have size 4
}
"throw if a database name doesn't exist in the config" in {
import SUTWithBadConfig._
api.dbConfigs[BasicProfile] must throwA[PlayException]
api.dbConfigs[BasicProfile]() must throwA[PlayException]
}
"throw if a database config doesn't define a Slick profile" in {
import SUTWithBadConfig._
api.dbConfigs[BasicProfile] must throwA[PlayException]
api.dbConfigs[BasicProfile]() must throwA[PlayException]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private[evolutions] class DBApiAdapter @Inject() (slickApi: SlickApi) extends DB
}
.toMap

override def databases: Seq[PlayDatabase] = databasesByName.values.toSeq
override def databases(): Seq[PlayDatabase] = databasesByName.values.toSeq

def database(name: String): PlayDatabase =
databasesByName.getOrElse(DbName(name), throw new IllegalArgumentException(s"Could not find database for $name"))
Expand Down