I have two domain classes Question and Tag. Question has 'hasMany relation' with Tag.
I am trying to save a question with some tags, but the error message is "Failed to convert property value of type java.lang.String to required type com.org.Tag for property tag; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.org.Tag] for property tag: no matching editors or conversion strategy found "
from my UI how can i send the list of Tags into QuestionController and how can i save Question with relationship with Tag
Your currently having static hasMany = [tags:Tag]
But i believe you might be storing it directly as a string
questionInstance.tags = ['tag1', 'tag2',...]
as opposed to
questionInstance.tags = [new Tag(name: tag1), new Tag(name: tag2),...]
I skipped the looping through tag values to show you whats implied. Hope this helps.
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