The view (and the form_for method) assumes the presence of a real presence model in the @presence variable. The @ -variable variable is passed through the controller, which means you had to set it in the controller action.
In the case of a "new" action - you do not have an existing Presence object that you are playing with (as opposed to, say, "show"), so you just need to create an empty, new one.
In the form_for method, there will be a Presence object similar to this, and: if it exists from db, it will create the correct POST route to update it. But if it is new, empty, it will create the correct route for creating a new one.
Hope this helps ...
Taryn east
source share