#105 Model Hook Does Not Fire

This “feature” could drive you nuts.  There are two ways to use the link-to helper in your templates.

If you have a route /project/:project_id that works with a Project model, then you can generate a link-to helper by passing the model:

or by passing the model’s id:

Ember is smart enough and knows how to render the link correctly both ways.  If you pass the model then the model hook will not fire.  If you pass the ID, the hook will fire as expected.

Now that I know this, it makes sense but it drove me nuts trying to debug why my model hook wasn’t firing.  It makes sense because if you are passing the model, Ember probably assumes (correctly) that you already have the model so why hit the server again.  Makes sense, right?

This is one of those things where conventions are awesome but only if you know what they are.

Updates

I have been busy working on all sort of different things – ember and otherwise.  This means we have a bunch of tips on our todo list.

One thing we are working on is an ember+rails SAAS starter kit, you can read more about it here.

We are also using the starter kit to build a SAAS product called Hyperlogs – it’s a time tracker for freelancers and small teams.  It’s not ready for beta testing, but you can signup for the waiting list here.

Promise: I promise that you will never receive an email without a tip, so stay subscrbied and you will get more tips.  I cannot do daily tips but we have a bunch lined up – stay tuned.