8 Posts in Rails
In the last post, we set up Rails to serve up a list of cars. Now let’s hook up Ember to display that data.
Shortly after sitting down to try and learn Ember.js, I learned that Ember has a “Getting Started Problem.” Everything in the docs seems reasonable, but when you go to make a real world application with a real web server, you realize there are a lot of gaps. Each individual component is well documented, but gluing them together proved to be an exercise in frustration. There are not very many examples of best practices within the context of a real application, instead of a single page to-do app. In this post I’ll take you through making a single CRUD resource. I’ll use a toy example of a car database, from which you can create, read, update and delete cars. We’ll be going through a typical Rails application to serve up JSON using Active Model Serializers to feed the client side application using Ember.js and Ember Data.
Testing is important in any software project. The faster the code is tested and the shorter the feedback cycle, the better. Here’s how to set up Guard and Guard::MiniTest to provide notifications for the fastest feedback loop possible. Anytime a file watched by Guard is saved it will run the test suite and pop up a notification. Head past the break for the details
Setting up a foreign key relationship in Rails is easy, however, the form for the relationship proved to be a bit tricky. Ideally, you want the foreign key to be selected if it’s set in the show view and you want it to save in the new and edit views. Here is how to make that happen.