Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The value of the parameter passed to the child template is cast to a String #506

Closed
logue opened this issue Apr 30, 2020 · 3 comments
Closed

Comments

@logue
Copy link

logue commented Apr 30, 2020

An error occurs when send an object to a child template with the with statement of include.

{% include 'partial/summary' with {post: post} %}

At this time, when trying to cast the value of post to the String type, an error of class dev.logue.app.models.Post cannot be cast to class java.lang.String occurs.

The contents of the post are as follows:

Model: dev.logue.app.models.Post, table: 'posts', attributes: {body=Post body, created_at=2020-04-15 18:27:15.0, id=2, title=Post title, updated_at=2020-04-24 16:41:17.0}

Note: dev.logue.app.models.Post is child class of org.javalite.activejdbc.Model.

Also, it seems that the model values cannot be expanded normally. When fetching the title, the value cannot be fetched without using the method like post.get('title') instead of post.title. At least JTwig was able to get the value correctly this way.

@ebussieres
Copy link
Member

@logue Can you submit a unit test to demonstrate your issue please ?

ebussieres added a commit that referenced this issue May 3, 2020
@ebussieres
Copy link
Member

@logue I created a unit test and I can't reproduce your problem. 09cad2a

ebussieres added a commit that referenced this issue May 21, 2020
@ebussieres
Copy link
Member

Due to absence of response, I'll close it. You can reopen it if you wish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants