Skip to content

Instantly share code, notes, and snippets.

@fringedgentian
Last active August 29, 2015 14:00
Show Gist options
  • Save fringedgentian/11044160 to your computer and use it in GitHub Desktop.
Save fringedgentian/11044160 to your computer and use it in GitHub Desktop.
This does not work, please do not use this if you get to this via search
object Node {
import Connector.db
def apply(nid: Int): Option[Node] = {
db withSession {
val ntype = Query(NodeMap).filter(_.nid is nid).map(_.ntype).firstOption
ntype.map { typestring =>
typestring match {
case "page" => new Page(nid)
case "landing_pages" => new LandingPage(nid)
}
}
}
}
}
Here is a Subtype
class Page(val nid: Int) extends Node with ImageService {
val image = getImage
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment