coderberry

Authentication With EmberJS - Part 1

Updated Feb 20, 2014 to use Ember v1.4.1

Authentication with Ember is difficult. I have spent a couple of weeks trying out different approaches and failing time and again. With the help of Ryan Florence and Brad Humphrey, I have finally been able to understand how it should work and also have built a simple application which uses it.

My goal in this article will be to build a simple Ember application with a RESTful backend (in Rails) which provides authentication and user registration. We will also set all requests to pass the access token to our backend for authorization.

Useful Functions in the Ember Namespace

Have you been frustrated at all with Ember because of a lack of common functionality? Well, if you are you are probably like how I was and forgot to read the manual. There are a lot of really excellent functions baked right into the Ember. Here are some really useful ones that may come in handy and save you a few keystrokes. Many of the examples below are taken from the Ember API docs and a few are taken from the Discourse source code.

Using Flash Messages With EmberJS

In a recent app I have written in Ember, I found that the need to display flash messages came up. This has always been given to me for free with Rails, so I didn’t really think of it not being just as easy to integrate using Ember. I was wrong.. well, sort of wrong.

On searching the web for ‘ember flash’, I found a nice little library at https://github.com/cheapRoc/ember-flash by cheapRoc. After some minor tweaking and customization, I was able to get it working in my app.

In this post, I want to share how easy it is to integrate and offer a little explanation as to how it works.

AngularJS on Rails 4 - Part 2

Let’s pick up where we left off. If you haven’t already, make sure you go through Part 1 to create your base Rails app with the API setup.

You can either continue using the code you have created on part 1 or you can catch up by checking out the tagged code:

$ git clone https://github.com/cavneb/angular_casts
$ cd angular_casts
$ git checkout step-1
$ bundle install
$ rake db:migrate; rake db:migrate RAILS_ENV=test
$ rake test
$ rake screencast_sync:railscasts

AngularJS on Rails 4 - Part 1

Angular seems to be the big craze as of late. Some may agree and some may not, but AngularJS is one of the next big contenders for being the number one choice of developers. At the time of writing this article, AngularJS is the 12th most watched project on GitHub.

Here I want to create a useful Rails application using Angular. The goal is to have a single-page application which allows us to select a screencast link on the left and view it on the right. An example of this would be found at http://ember101.com.

Originally I had presented this topic at our local ruby users group. My typical workflow is to write a blog post before presenting and have that post be a reference to my presentation. Since then, I have received a lot of feedback on how I could have enhanced the app. These posts (part 1 and 2) been re-written to reflect those changes. Special thanks goes to Tad Thorley for providing the excellent example application based off of the original. Also thanks goes out to those who have commented on these posts.