What is the best way to integrate angular js app to Rails asset pipeline? - ruby-on-rails

I had an application deployed on two servers : an apache for AngularJS and a Unicorn for Rails 4. Now I want to integrate the Angular app into the Rails one. What is the best way to do this?

In addition to Kevin B's comment, here's a cool tutorial on using Rails (Rails 4) to build a JSON REST API that interacts with an AngularJS frontend. Link: https://thinkster.io/angular-rails/ GL!

Related

Can you use a Rails Engine with a JS Framework like Vue

I want to do a project with https://github.com/projectblacklight/blacklight
Can I use it as a Rails API with a Vue frontend?
It is a Rails Engine that returns JSON but it is traditionally used in a Rails app as a Plugin / Gem (really it's an engine which is similar).
https://github.com/projectblacklight/blacklight/wiki
Every Blacklight search provides JSON, RSS, and Atom Responses of search results
I am researching this and so far I think the answer is yes.
Jason Coyne from Stanford built an App using Ember with Blacklight
Here are some more discussions around the question.
+ https://github.com/projectblacklight/blacklight/wiki/JSON-API
+ https://github.com/projectblacklight/blacklight/pull/588
+ https://groups.google.com/forum/#!topic/blacklight-development/TIYCjemfp3A
There is not a lot of documentation about this that I can find.
blacklight-vue is an engine made explicitly for this purpose. blacklight-vue-demo is a sample build with this engine. The generic answer for building any Ruby on Rails application with Vue is to use the Webpacker gem.

Rails API + AngularJS + Websocket-Rails gem

My server is running the websocket-rails gem to handle websockets.
I'm having trouble using websocket-rails with a phonegap project that uses angular because I need to initialize the websocket-rails client in my Angular front end independent of the rails asset pipeline.
Is it possible to load the websocket-rails client separately into an angular project? Or can I use an angular socket directive to manange sockets with websocket-rails?
I managed to get this working.
I translated all the coffeescripts into js with the coffescript CLI tool. Then I added those files to my project then called the methods in the controller per the websocket-rails docs.
This guy has done the same translation. A github repo with the translated files. Hope it can help someone:
https://github.com/karimbutt/websocket-rails-for-js-frameworks

Bundle a rails 4 application into a gem?

I am currently developing a rails 4 based media streaming app and wanted to know if i could have the rails app as a kind of source code and bundle it into a gem for distribution? is there some sort of easy solution for this? or do i have to roll my own?
From your description, I think you can do this via an Engine. From the Rails docs:
Engines can be considered miniature applications that provide functionality to their host applications.
...
Engines are also closely related to plugins where the two share a common lib directory structure and are both generated using the rails plugin new generator. The difference being that an engine is considered a "full plugin" by Rails as indicated by the --full option that's passed to the generator command, but this guide will refer to them simply as "engines" throughout. An engine can be a plugin, and a plugin can be an engine.
Read more at http://guides.rubyonrails.org/engines.html

HTML site to Rails

I'm trying to learn Ruby and Rails. So, I've created a template site with Foundation framework for HTML and CSS. Now, at the begining, I want to add multilanguage platform to this site. I knew about i18n on Rails.
But my question is about:
How to move html site (f.e. mine) to ruby on rails platform? Is it enough to move template rails project to my site and then merge it? As I understand Cloud9 IDE support rails platform

Rails 3 CMS that doesn't mess with your application's code

For a client I have to build a CMS with my Rails 3.2.2 application. The thing is, the app is ready-to-go. Without the CMS, that is. I just have to implement a CMS, but when I tried to do that with RefineryCMS (following Refinery's own instructions), it didn't work, because Refinery didn't pick up the CSS and pages I had made.
What should I do? Is there another, useful CMS-plugin for an existing Rails app? Or should I build a CMS myself, with stuff such as omni-auth? If so, is there a tutorial around for building such a CMS?
Thanks a lot!
Have a look at copycopter it might fit your needs.

Resources