#410 Ember Part 2 pro
Here we continue our look into Ember.js. First we add a JSON API to persist the entries through ember-data. Then we finish up the project by adding a computed property and a view object.
- Download:
- source code
- mp4
- m4v
- webm
- ogv
Nice episode!
I probably wouldn't have made the separate view for the submit form. Consider the alternative:
This way, both clicking the submit button and pressing enter within the text field will fire the
addEntry
action which gets handled by the controller.I'm really curious to see Ryan's take on http://batmanjs.org/ (please do cover it)
+1.2
+1
Oh yeah +1
+1
+1
Batman.js is no longer maintained.
+1
If you're going to keep previewing JavaScript frameworks can you please build a new app rather than do Raffler all over again. I get that it allows us to compare, but it also gets really samey-samey after a watching it being built 3,4,5 times.
So true +1
It's sometimes so boring to see the same functions all over.
What do you suggest he builds? I think the point is to just show the basics of working with the technology. I'm happy with samey.
There's a ton of simple apps he could make. A blog, a forum, a store etc
I have to agree with this. Ryan normally provides an amazing resource in Railscasts, but I find the raffler example too contrived to be useful. Especially for a pro cast.
It is samey but it demonstrates all the things you need to know about these frameworks.
I'd expect these screencasts to take a lot longer to produce if Ryan had to write new boilerplate for each one.
Disagree. I don't watch these to be entertained, and to really do a fair apples-to-apples comparison with backbone and angular, we have to see the same app being built with them all. It's the only way to really understand the different approaches, and how much code/work/learning each takes to accomplish the same thing.
It's like todomvc -- it's a goto app? Would you rather he do todomvc?
When server side validation fails how does ember handle it?
I assume it is up to you and what status you get from your JSON call
Ember Data expects the server to respond JSON with errors as the root key, then the attribute name with the errors nested inside of that. You can basically do the following in Rails and Ember will accept it.
This will set 'isError' on that model and will remain at isError (and refuse to commit) until the attributes that the server said had errors are changed.
If there was a railscast I'd wish it was covered with tests, then this is the one.
+1
+1
Ryan what would you choose between BackboneJS, Ember or Angular ? I really like Angular.. what do you think ?
Ryan, I hope you like Backbone best :), and use it instead of the others if you go deeper into these frameworks, which I also hope you do--rather than continuing to introduce new ones.
Having seen your coverage of Backbone, Angular, Ember etc, I'd feel pretty confident about learning batman.js on my own, for example, if I felt there was a need, and I assume it'd be similar for other subscribers. However, I'd really like to see you go deeper into how Backbone and Rails can be used together. Just my two cents.
Great episode as always.
The only suggestion I have is to include testing in all new episodes, it would add a lot of value to your screencasts and I know new developers like myself would appreciate it. Hell even if you don't cover the tests in the screencast but include them in the source code I would learn something.
Railscasts make me more and more sad lately: boring reviews of monstrous js-frameworks instead of hardcore rails features.
Had I wanted to be js-guru I would have subscribed to something js-oriented, not rails.
It's time to be renamed to jscasts. Waiting for node.js reviews as a part of digging inside trash process.
Rails gurus should probably have a pretty good idea how client side js frameworks work with Rails.
JS frameworks interact identically with all server-side frameworks. Rails integration process is tivial and is not worth half of all last month's episodes
Yes, I also find js-episodes quite boring and distracting from the Rails theme
It's tough to find beyond beginner level videos for a lot of this stuff. So I don't mind the JS at all.
There are about forty bajillion Rails episodes. Did you want all of those? :)
Thanks for the Ember series, Ryan. ExtJS has taught me how NOT to do SPAs, now I'm looking for ways to do them right. Will there be, or could there be, an Ember Part 3 episode covering validation, error handling, and testing?
Hi Ryan,
Thank you very much for covering some Ember.js casts, it was enough for me to get me to start using it. Like giving me the right keys to open the doors I need.
I didn't miss tests like others suggested, my opinion is that it keeps you up in speed with covering several subjects in a short time.
To all the guys with suggestions to make the casts more sophisticated, packed with tests or other app types, don't need another peepcode.com site. I like the weekly and relatively short casts.
Keep up the good work Ryan, keep it simple!
Cheers Ryan, much appreciated.
One thing tho (that doesn't really matter!)...
entires_controller.js.coffee should be entries_controller.js.coffee surely?
+1 on Rachid comments - one of the things I love about railscasts is how succinct they are.
I also had to commit the record creation, here's my
addEntry
(ember 1.0.0-rc.1)... I see Ryan adds it at the end of the episode, I had to do it when I first implemented the storeage
What is the proper way to delete an Entry?
Ok. Found it!
My issue was that I was not calling 'deleteRecord()' on the 'content'.
On REVISION: 12 it's not needed anymore. obj.deleteRecord() would suffice.
I'm wondering how can I load a SelectBox using a restful resource.
However it does work, I'm not sure if I have to load the content to the controller first, because I have the route in this way.
Any Ideas?
When implementing the disable/grey-out feature on the "Draw Winner" button, the button wasn't "greying out" for me due to missing CSS styling in the layout.css.scss file.
During the first Ember railscast, I had grabbed the CSS styling per the below link. That CSS file however lacks the necessary styling for the grey-out.
Ember railscast #1 CSS
https://github.com/railscasts/408-ember-part-1/blob/master/raffler-after/app/assets/stylesheets/layout.css.scss
Ember railscast #2 CSS
https://github.com/railscasts/410-ember-part-2/blob/master/raffler-before/app/assets/stylesheets/layout.css.scss
Cage Match - EmberJS vs. Angular http://vimeo.com/68215606
Anyone else have problem with the pluralization?
This is in my store.js.coffee
But it is still looking for /entrys. Any thoughts?
I was facing the same problem. I found out the problem was because the latest "ember-rails" gem added a custom adapter for you, you need to set the "plurals" for that adaptor, but screencast set the config for the default one.
The simple solution is to delete the line
adapter: DS.RESTAdapter.create()
and force app to use default adaptor, and it should workThe directory path for store.js.coffee in the Show Notes has the wrong label. It should be in the right place if you generated it. If you placed it there based on the show notes, it might not work.
It should be
Receiving console error:
Error while processing route: entries undefined is not a function TypeError: undefined is not a function at RandomRaffle.EntriesRoute.Ember.Route.extend.setupController
and
undefined is not a function TypeError: undefined is not a function
at RandomRaffle.EntriesRoute.Ember.Route.extend.setupController
when I add RandomRaffle.Entry.find() to my routes. Any ideas?
Much interesting article and wanna say thanks a lot for providing this marvelous article.
If you're going to keep previewing JavaScript frameworks can you please build a new app rather than do Raffler all over again.
nice post
now you do not have to worry about condyloma disease accuminata / genital warts because we have been providing herbal medicine, for this one disease