ActiveWeb - rendering parent attribute value

20 views Asked by At

Suppose Author belongs_to Boook. Is it possible to do the same as in Rails templates in a Freemarker template:

"author": ${book.author.last_name}

I tried without success. May be my syntax is wrong or I'm missing something ?

1

There are 1 answers

1
ipolevoy On

You would need to use the include() and pre-load objects for this. Please, see: http://javalite.io/lazy_and_eager#eager-simultaneous-loading-of-parents-and-children

You would need to experiment with code a little. In the worst case, you can add a method to a model and call that from a template.