Help with single page application structure

I’m planning on creating a single page application using AngularJS on
the
client side.

I’m not sure if I should use Rails as it is, or the Rails API gem or
some
other solution.
Anyone got any suggestions on how you structured your application?

Should I be using the asset pipeline? Or should all client side stuff be
separated from Rails?

I’ll be creating a simulation engine for this application to simulate
results that the application will show.
Using Rails I thought I’d make the simulation engine a Rails Engine to
separate the logic from the rest of the application.
Is that a good idea? Can the Rails API gem make use of engines?

On Tue, Apr 2, 2013 at 8:43 AM, Johan V.
[email protected] wrote:

I’ll be creating a simulation engine for this application to simulate
results that the application will show.
Using Rails I thought I’d make the simulation engine a Rails Engine to
separate the logic from the rest of the application.
Is that a good idea? Can the Rails API gem make use of engines?

A colleague and I were having a very similar discussion today. He
allowed as he just wrote his own asset pipeline, combining together
all the various compilers and converters and such into something
pretty simple that he’s using under Sinatra. He had said he initially
thought about using Rails minimally for the asset pipeline, but then
came up with this.

I think for me, using Sinatra would mean I’d have to write a lot of
things
that Rails bring which I don’t want to.

Is it a viable alternative to separate client and back end?

To have AngularJS take care of everything client side and Rails take
care
of only the back end?

On Apr 4, 2013 7:20 AM, “Johan V.” [email protected]
wrote:

Is it a viable alternative to separate client and back end?

To have AngularJS take care of everything client side and Rails take care
of only the back end?

Absolutely, you can go so far as to have your SPA initial download be a
static index.HTML in …/public, and just have your routes speak JSON to
the
Angular requests. I’m working on this currently only using backbone and
underscore.

On Apr 4, 2013, at 8:31 AM, tamouse mailing lists wrote:

On Apr 4, 2013 7:20 AM, “Johan V.” [email protected] wrote:

Is it a viable alternative to separate client and back end?

To have AngularJS take care of everything client side and Rails take care of
only the back end?

Absolutely, you can go so far as to have your SPA initial download be a static
index.HTML in …/public, and just have your routes speak JSON to the Angular
requests. I’m working on this currently only using backbone and underscore.

There’s a few Railscasts that cover Ember and Angular and they all start
from this premise. You use Rails, but you don’t do that much in it. It’s
just there providing the persistence, and all of your real work happens
in the public folder.

Walter

I’ve initially made a HomeController that serves the initial index view
(with it set as the root in routes) but I think I like the /public way
better.

Thanks for the idea!

On Thursday, 4 April 2013 14:31:09 UTC+2, tamouse wrote:

Absolutely, you can go so far as to have your SPA initial download be a

Do you disable Rails routing somehow when using client-side routing?

On Thursday, 4 April 2013 14:31:09 UTC+2, tamouse wrote:

Absolutely, you can go so far as to have your SPA initial download be a

On Apr 4, 2013 1:35 AM, “Johan V.” [email protected]
wrote:

I think for me, using Sinatra would mean I’d have to write a lot of
things that Rails bring which I don’t want to

Agreed; we were talking alternatives and for his needs, he really only
needed the pipeline.I was just trying to illustrate that stripping Rails
isn’t the only direction one can go.

This tut shows a combined approach:
http://blog.berylliumwork.com/2012/09/tutorials-on-angularjs-and-rails-2.html?view=classic
(Don’t forget to download angular-resource and require it in
application.js. Other than that, everything worked.)

I’m fiddling with it right now, because I don’t really want a single
page
app, and I really, really don’t want a weird URL structure.