Question

I have an object profileModel in my profile package and my profile.scala.html file have following code

@(model: ProfileModel)

when I compiles, it is giving an error recursive value model needs type

But when I moved this class to models with my application.conf as

ebean.default="models.*" 

it works. My guess is scala compiler automatically adds models.* to class path at the time of compilation

Is there a way to make this work without moving the class back to models package ?

I am using play 2.2.1 built with Scala 2.10.2

Was it helpful?

Solution

If I understand you right, if your ProfileModel exists in profile package correct declaration in the view should be:

@(myProfile: profile.ProfileModel)

And 'yes', Play imports automatically all models and controllers (and also other well known types), but if you want to use any type in custom package (or ie. imported lib) you need to use full qualified path to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top