Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesward committed Apr 28, 2012
1 parent f0a3a3f commit 7463bcc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 30 deletions.
16 changes: 4 additions & 12 deletions app/models/Bar.scala
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
package models

import play.api.db._
import play.api.Play.current
import net.vz.mongodb.jackson.{Id, ObjectId}
import org.codehaus.jackson.annotate.JsonProperty
import play.modules.mongodb.jackson.MongoDB
import reflect.BeanProperty


class Bar(@ObjectId @Id val id: String,
@BeanProperty @JsonProperty("name") val name: String) {
@ObjectId @Id def getId = id;
class Bar(@ObjectId @Id val id: String, @BeanProperty @JsonProperty("name") val name: String) {
@ObjectId
@Id
def getId = id;
}

object Bar {
private lazy val db = MongoDB.collection("bars", classOf[Bar], classOf[String])

def create(bar: Bar) { db.save(bar) }
def findAll() = { db.find().toArray }

def apply() = {

}

def unapply() = {

}
}
2 changes: 1 addition & 1 deletion app/views/index.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(form: play.api.data.Form[Bar])
@(form: play.api.data.Form[String])

@main("Welcome to Play 2.0") {

Expand Down
5 changes: 3 additions & 2 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ application.langs="en"
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=

Expand All @@ -45,3 +45,4 @@ logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG

mongodb.uri="mongodb://127.0.0.1:27017/play2bars"
12 changes: 0 additions & 12 deletions conf/evolutions/default/1.sql

This file was deleted.

6 changes: 3 additions & 3 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ object ApplicationBuild extends Build {
val appVersion = "1.0-SNAPSHOT"

val appDependencies = Seq(
"org.squeryl" %% "squeryl" % "0.9.5",
"com.jquery" % "jquery" % "1.7.1"
"com.jquery" % "jquery" % "1.7.1",
"net.vz.mongodb.jackson" %% "play-mongo-jackson-mapper" % "1.0.0-rc.4"
)

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
// Add your own project settings here
)

}
}

0 comments on commit 7463bcc

Please sign in to comment.