I’m giving a talk this week about params and I want to make sure I’m giving the best the right information.
Would you give me feedback as to whether this code is idiomatic. The data is gathered in a form I have include the controller that gathers the form data and transforms it for the route.
The URL www.example.com/flights/2013-11-21/2013-11-30/seattle-auckland
Its difficult to tell without seeing the context for this code but you seem to have a lot of duplication. Usually, in the model hook you would return the results of your query which you seem to be doing in controller.send(‘sendResults’). By doing this, you’re bypassing all of the goodness of the promise based router.
For this part of the app I’m discussing here the user enters date and location information into a form then the system sends that data through a web socket as I said. The web socket once triggered will return a series of flight results where ember will add each of the results into the list ordered by price. From there the user will be able to filter the results further.
I feel like something smells, but I just can’t put my finger on it.
Can you show me the code for sendResults action from the FlightsController?
The FlightSearchController & FlightsRoute do something that seems strange to me. You’re handling an object that has params in place where resulting data should be. This starts in the last line of FlightSearchController#actions#save which passes url parameters as an object. This causes the Router to skip FlightsRoute#model because it assumes that it already has a model for this route.