Thursday, 14 June 2012

No signature of method: org.codehaus.groovy.grails.web.servlet.GrailsFlashScope.success() is applicable for argument types: (java.lang.String) values: [Comment created!]

So I'm trying to add informational flash messages to display to my users. In my controller I set something up like this:



                if (createAndSaveComment(tweet, comment, currentUser) != null) { 

                     rabbitSend('comment.created', '', tweet.id) 

                     flash.success('Comment created!') 

                }  


Seemed correct, right? WRONG! This is what the error I got:



 No signature of method: org.codehaus.groovy.grails.web.servlet.GrailsFlashScope.success() is applicable for argument types: (java.lang.String) values: [Comment created!]  


Turns out I'm doing it wrong. It should look like this:



                if (createAndSaveComment(tweet, comment, currentUser) != null) { 

                     rabbitSend('comment.created', '', tweet.id) 

                     flash.success = 'Comment created!'

                }  


You might be snickering at this point because I made such a stupid mistake...well it's late in the day and I've been coding since 8am okay? Give me a break!


No comments:

Post a Comment