I'm using the Play Framework yabe tutorial and came across a problem when adding tags. I'm not sure what code I added that caused the change, but now the Fixtures.loadModels(data.yml) piece of code searches for a file in .../some_folder/play-1.2.1/modules/docviewer/app/data.yml instead of .../some_folder/yabe_tutorial/conf/data.yml as it should.
Here's my code in the default package of /yabe_tutorial/app:
@OnApplicationStart
public class Bootstrap extends Job {
public void doJob() {
if (User.count() == 0) {
Fixtures.delete();
Fixtures.loadModels("data.yml");
}
}
}
Is there any settings I can use to change the directory that loadModels uses?
I'm new to this all, so I'd really appreciate some help. Thanks!
Sigurd is right. Fixtures.loadModels()
looks for the yml file in Play.javaPath
. Try renaming your data.yml
file to some unique name like data-appname.yml
and change the filename in your code as well.
@OnApplicationStart
public class Bootstrap extends Job {
public void doJob() {
if (User.count() == 0) {
Fixtures.loadModels("data-appname.yml");
}
}
}
Worked for me.
Another option is to use Play.applicationPath
which contains the location of root directory of the project
Fixtures.loadModels(Play.applicationPath + "/app/conf/data-appname.yml");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With