Persisted Changes in Grails not showing up in application
I have just started developing a Grails app froma tutorial today, and I have noticed that when I save changes to Domain objects, the changes aren't being reflected immediately throughout the application.
I have a simple Account object that is used to login to the app, and I have the basic Grails scaffolding providing CRUD functionality to change the object.
Once logged on, the index.gsp displays a welcome with information from the user's Account object (biography, description etc) - however, if i change the Account description (using the scaffolded CRUD) and return to index the change is not reflected (although if i view the default list.gsp page for the Accounts the change is reflected there).
---EDIT---
The account domain object is the object that we use o authenticate/login with. an exmple index sinppet looks like this:
<p class="header">${session.user.login}'s Profile</p>
This just displays a welcome to the user - However, if i go to the account controller CRUD page and change the user name (login) then it isn't reflecte开发者_运维技巧d in the index (even after complete refresh of browser). I have noticed that if I leave it to expire the session and then log back in again it is all good.. Should I be getting the account object by some means other than by the session.user?
Am I missing something obvious?
Thanks
Well, I know Getting Started with Grails. It's very good for starter, though there's some not-updated details. As I remember, its default homepage have the information about the controllers, but not any domain object?
About your question, I think you should check the code of home webpage/ and controller file. It's in \grails-app\views
and \grails-app\controller
.
OK, I have resolved this - so the session.user wasn't being updatedvdruing the session.
I just created a custom tagLib to get the current user and display the relevant details rather than try to extract them straight from session.user..
精彩评论