Last active
August 29, 2015 14:00
-
-
Save fringedgentian/11044160 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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