Skip to main content

Earn a free month

What's up guys? Welcome to the series on how to use Ember with Ruby on Rails, and this is taught by a friend of mine, Jeffrey, who runs Ember school and ember screencasts, now he does a similar thing to GoRails, he just focuses on Ember, and because I didn't plan on covering Ember myself in GoRails, I figured, why not? We can have him teach a series on how to set up ember, why you might want to use it, and how to use it with the Rails API, and we'll go through all of that in a series, and he'll teach you how to do that, and so this is going to be a really good introduction for using ember with rails. Without further ado, I will leave it to him.

Hey there, I'm Jeffrey from, in this series, I'm going to show you how ember can work really well with rails, but first you may be asking: Why would I want a front-end framework? Can't I just turbolinks this whole thing? Well, the thing is, users are starting to expect native quality apps online, and if you want to provide that, then you're going to have to provide some sort of JavaScript, but unstructured JavaScript is a nightmare to work with. Maybe not at first, but as you keep on adding use case and use case, it's really hard to remember where you put what, and how this works, you have 10 competing different styles, and if it get big enough, the thing is: You can't not have a framework. Either you're going to use one that's been worked on by hundreds of other really smart people, or you're going to cobble one together as you build your app. The thing is, if you take that option, then the framework that you're going to be working with is going to be really bad. It will be buggy, and the features won't be thought through, because you didn't know you were making a framework. You thought you were just making another feature, and then, two months later, you swear off JavaScript forever, and you hope turbolinks 4 will finally fix your problems.

Or, you could do a front-end framework. So why ember, specifically? Ember works really well for people that have been using rails for a while. It shares a lot of the same philosophy, one of which is convention over configuration. So in ember, there's a default. There's a really smart, well thought out default, but if you're in one of the five percent of people who that default doesn't work for, there are other ways to go about it, you can still configure it, but for most of the people, you don't have to think about the silly things. Ember and rails, they integrate together easily. ActiveModel serializer is the most common integration, but there's a lot of work being done on JSON APIs as well. Then there's the add on ecosystem on ember, which matches rails gem ecosystem, so you want some functionality, well you just grab an add on someone's built to be able to do that, and so far, ember iss the one with the most solid addon ecosystem, the others are trying to hack something together, I hear there's good stuff happening on webpack, but ember's addon story is the most solid so far, and because of the convention over configuration, and the addons, and the easy integration with rails, that means you're going to be productive really quickly, weather you're setting up an app yourself, or you're joining an existing team. At this point, you're going to be asking: What are the downsides? Well there are a couple. The first is that more powere means that there's more to learn, so if you're someone who prefers Sinatra over Rails because there's less API surface area, then you may try doing React. It's much smaller, and it does way less for you. The apps that you're going to be able to build easily are more simple, but there's less to learn. So you will be up and running quicker, and the second thing is that ember does want your entire page. It doesn't necessarily have to have your entire app, althought it does want that too, but whatever page you stick it in, it's going to want to take over that, and you should let it. There are some things coming that will make sticking in little bits of ember into your app easier. Look for the glimmer two rendering engine soon, but for now, ember does want your entire page. Now, I'm not going to tell you more about why you should use ember in a series. If you want to know more, I wrote an article with the codeschool blog called: Seven reasons to use ember, and I also created a talk, called: "Embering on the shoulders of Giants" and those two links will be in the shownotes, so if you're not convinced and want to know more, then go ahead and click on those links. If you are convinced, and you want to set up your first ember app, then join me in the next video.

Transcript written by Miguel


Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.