Menu icon Foundation
Foundation for Apps with Rails 4 Best Practices

Hi,

I have not played much with Angular yet though I have been walking through the tutorials. I have a couple of Rails 4 apps, but want to start a new one using Foundation for Apps...

What I want to know is what the best practice is for using Foundation for Apps (and Angular) in the front-end and Rails in the back-end. Is it best to have two separate apps (one Foundation, one Rails) or is there a way to integrate them like there is for Foundation for Sites? If possible I'd like to integrate the two. I am not sure whether to use Foundation CLI or rails new or even rails-api new at the moment, any advice would be greatly appreciated.

foundation for apps

Hi,

I have not played much with Angular yet though I have been walking through the tutorials. I have a couple of Rails 4 apps, but want to start a new one using Foundation for Apps...

What I want to know is what the best practice is for using Foundation for Apps (and Angular) in the front-end and Rails in the back-end. Is it best to have two separate apps (one Foundation, one Rails) or is there a way to integrate them like there is for Foundation for Sites? If possible I'd like to integrate the two. I am not sure whether to use Foundation CLI or rails new or even rails-api new at the moment, any advice would be greatly appreciated.

Paul Gatt over 4 years ago

Any ideas? Been a week with no comments.

James Stone over 4 years ago

If you take a look at the source you will see that you can integrate foundation for apps in a variety of ways. There is an included gulp script that takes care of most things for you, but you can directly integrate the sass and javascript using the sprockets / asset pipeline. You will need to copy the files to appropriate locations and a gulp or grunt script could help with automating this if you plan on upgrading frequently.

Then if disable the original bower_components/foundation-apps/js/angular/app.js and base your js file on this to your liking, you can then start to build out the app / controller portion of your ng app, using additional directives as needed and also being able to use your own directives.

I am not using rails much anymore, but I assume you would use something like rails-api to easily wire your rails portion of the app up to angular. Here is a tutorial to get you started, or you could post or look around on the regular rails / angular haunts or SO.

Keep in mind you will lose the functionality of the gulp workflow that ZURB has created. That means no yml style front matter to run ui-router. You would need to configure ui-router separately, or integrate the gulp workflow into your rails app rather than use the sprockets / asset pipeline.

If you get something up and running, reply back and report back what you find out.

Mike Stecker over 4 years ago

I'm interested in this as well. Foundation for Apps looks incredible. I'm not a Rails guy, I'm more of a general front-end guy but we have a Rails project starting and I would love to use Foundation for Apps in it.

Richard LaFranchi about 4 years ago

Hello,

I know it's been a while since this post was created, but I have a github repo that can be used as a starting point for using foundation for apps with Rails.

Here's the repo:

https://github.com/rlafranchi/foundation-apps-rails

And here's a demo:

https://young-fortress-5170.herokuapp.com/posts