What’s up ya’ll. I knew if anyone would have an answer or help it would be here. I am using a PHP framework called Laravel as an API and I am having some troubles getting Ember to persist the form post. The form data saves and can be seen in my other route but not in the database, and disappears after refreshing the page. Here is my route - I’ll post my Laravel controller too in case there any Laravel experts here too but I really think the issue is with Ember because I can persist the post when I use the same route using just laravel.
I know this is a dumb question but could it be that my model name in Ember is library.js and the pluralized form is librarys, which I need the name libraries to be used for my api?
I’d assume at this point you want to load your libraries into the model of this route?
So it would be:
this.get(‘store’).findAll(‘library’);
Is your route named library or libraries? If it’s library the transition wont work because you try to transition to libraries, but I think this would throw an error
Which version of EmberJS/Ember Data are you using?
To the willTransition Event, maybe this might help:
A model is not stored on the route, it’s stored on the corresponding controllers model property (the model property of the route is the method which you override/implement to get the model). So, in your routes action, try
@nopyronoparty
Yeah sorry about that, I was on mobile and fudged up my reply to another thread. The route is nested in libraries.new (which is supposed to be posting the data), and libraries.index which is where all of the results are showing up and then disappearing.
Thank you for the link btw, I definitely need to brush up on my Ember chops especially transitions. The code doesn’t even make it to the transition, that is what I don’t understand. I am getting no errors so I am really puzzled by all of this.
You need to figure out why you don’t see error messages in the console. Put some console.log statements in your code to trace what’s happening or use your browsers debugger. Another thing is: The routes method to transition is called transitionTo and not transitionToRoute, see http://emberjs.com/api/classes/Ember.Route.html#method_transitionTo. I suspect you’re action never gets called since you don’t get an error logged.
hey guys thanks for the info…I won’t get to work on this until this evening but I will definitely take your suggestions @indr and put some console messages in the code. Also, thank you for clearing up the transitionToRoute(). I can’t thank you enough for your help man.