How to declare a variable named ‘type’ in Play/Scala?
Use backticks: var `type` = 42
Use backticks: var `type` = 42
Here’s my list, of course, with some duplications breaks backward compatibility (it’s a rewrite from scratch) core programmed in scala vs java (got to learn scala to collaborate) scala for templates (but work is being done on groovy templates as a module, to ease migration), so you have to specify the type of each parameter … Read more
@defining(“foo”) { title=> <div>@title</div> … } basically, you have to wrap the block in which you are going to use it
For this job you should go with javascriptRoutes as it generates correct JS paths based on your routes.conf. You’ll find usage sample in Zentask sample Anyway, for now you can fix your AJAX call by changing the url to url : ‘@routes.Application.saveDefaultPhoneForUser()’, This way requires it to place the whole JS in template, which is … Read more
You find an example on how to use the cake pattern / dependency injection to decouple the Slick driver from the database access layer here: https://github.com/slick/slick-examples. How to decouple the Slick driver and test application with FakeApplication A few days ago I wrote a Slick integration library for play, which moves the driver dependency to … Read more
Try Play.application().configuration().getString(“your.key”) As noted in the comment (nico_ekito), please use play.Play and not play.api.Play. play.api.Play is for scala controllers (see comment by Marcus biesior Biesioroff) Additionally, play uses https://github.com/typesafehub/config under the hood so it can also provide some insights.
Encode your optional parameters as Option[String] (or Option[java.util.Date], but you’ll have to implement your own QueryStringBindable[Date]): def birthdays(from: Option[String], to: Option[String]) = Action { // … } And declare the following route: GET /birthday controllers.Application.birthday(from: Option[String], to: Option[String])
The Play 2.0 Scala equivalent to this would be: Play.current.configuration.getString(“db.driver”) You will also need import play.api.Play The full docs for this are here.
I’ve ran into the same problem. The question here is that play-java-jpa artifact (javaJpa key in the build.sbt file) depends on a different version of the spec (version 2.0 -> “org.hibernate.javax.persistence” % “hibernate-jpa-2.0-api” % “1.0.1.Final”). When you added hibernate-entitymanager 4.3 this brought the newer spec (2.1) and a different factory provider for the entitymanager. Basically … Read more
[UPDATE] – added (yet another) explanation on for comprehensions The * method: This returns the default projection – which is how you describe: ‘all the columns (or computed values) I am usually interested’ in. Your table could have several fields; you only need a subset for your default projection. The default projection must match the … Read more