Getting Angular and Rails Working Together

April 07, 2014

I’ve been doing a bit of AngularJS at work, and getting it all working with Rails, the asset pipeline, testing, and deployment was quite a challenge. It wasn’t so much difficult to do, but difficult to uncover the right information. So, I decided to compile it all in a nice tutorial and post it as a free mini-ebook, in web form, also known as a website1.


Once you're familiar enough with Angular to start building an app, you'll find there are a lot of unanswered questions:
  • How do I serve Angular assets via the Rails Asset Pipeline?
  • How does Angular's templating system work with Rails?
  • How do I connect Angular to my Rails controllers?
  • How do I test my Angular code within a Rails app?
  • How do I manage all these JavaScript dependencies?
  • What challenges will there be in the production environment not present in the development environment?
I was able to find answers by piecing together information from Stack Overflow and various blog posts. You shouldn't have to do that.

Check it out, start making some awesome Angular apps with Rails, and correct any mistakes you find.

  1. 1I have a longer-term goal to make this an actual e-book, but for now, I wanted to get it out and get feedback