Rails Engine

Recently, I build some Rails engines. And I found it’s a good way to organize and share reusable code across a number of applications.

Rails Engine is not like Ruby gem. It’s more like a rails app, it has its own controllers, views and migrations. And basically it has two type of engine, full or mountable.

Angular on Rails - Basic Setup and Deploy


angular+rails

How to setup Angular with Rails

There are a lot of way you can integrate Angular with Rails, a common way is put Angular inside the Asset pipeline. It’s easy to integrate that way but the code base is quite mess at the later point. Recently, I found a way to use Yeomen generator and rails-api to work as front-end and back-end together.
Here’s some Pros and Cons for this way:

Pros:
  • Separate struct and codebase for front-end and back-end
  • Get rid of unused rails component like erb view template
  • No more need to fresh for front-end change
Cons:
  • have to deal with csrf token
  • need to setup the proxy
  • hard to deploy