I am making simple tree structure and in the tutorial is following:
- Build cache: TreeNode.rebuild_depth_cache!
I never use this command, I tried to give this line into my controller (in the action that I have loaded in browser) and tried to refresh and hoped everything will be ok, but no.
Cannot rebuild depth cache for model without depth caching.
(obviously I updated my model)
I tried to put this line into terminal window, but about error (command not found).
I am not sure where to put this command - into the controller (and there into an action) or into the terminal? I really don't know where this command should go, so I would like to ask you about the help...
Or, is everything other needed for run this command?
You need to run it in the Rails console: rails c
in your terminal. And then run your command TreeNode.rebuild_depth_cache!
.
The error is suspicious though. Are you sure you did not forget to call a class method in your model to make it act as a tree?
Can you link to the tutorial?