Open GLosch opened 9 years ago
OK. Is the latest code pushed?
Also is there a dummy user login you have offhand?
Yeah it's up to date, debugger
statement included :-)
passing in the el
property when instantiating the recipeView allows the event handler to trigger the saveModel function. But now there's an error: Uncaught Error: A "url" property or function must be specified
No route for /recipes
. Checking my routes to see what's going on there
progress! I added the user_id when the model is instantiated, so now it stores that in recipe_params on the backend.
Good news/bad news: it's saving the recipe to the dB! Bad news: it's saving every model on the page, not just the one that's clicked.
I'm trying to hit the saveModel function here: https://github.com/GLosch/rails-cookbook/blob/master/app/assets/javascripts/backbone/views/RecipeView.js#L15
but this.model is undefined. When the recipeView is instantiated, it's getting a model passed to it here: https://github.com/GLosch/rails-cookbook/blob/master/app/assets/javascripts/backbone/views/FormView.js#L57
...but when the RecipeView.saveModel() function is hit, the view no longer has a model associated with it.