How to configure your Rails engine with Rspec, Capybara, and FactoryGirl
1. Run the follow lines to generate a mountable engine
|
|
Tech && Learn && Fun
|
|
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.
If you ever build a SPA app with authentication. The most hard part is keeping users sign-in when they’re coming back/refresh the browser.
So, how could this thing work out?
One possible method is update your header when the user signed in.
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: