lundi 13 avril 2015

EmberJS accessing an association's data on create

I have 2 models: Task and Project, with a project having multiple tasks. But how can I create a new task for a specific project?


I have this route:

@resource('projects', -> @route('show', { path: '/:project_id' })


And in the projects/show-template I'm calling {{render "tasks" model.tasks}} to show all tasks belonging to a project + an input-helper to add a new Task. The problem is that I have no idea how to get to the project's id in the createTask-action (which resides inside the TasksController).


I can't access the params and I don't want to use a regex on the window.location to get to the id.


(EmberJS 1.10.0)





Aucun commentaire:

Enregistrer un commentaire