News for hackers. Stuff that matters.
Re:Introducing the Rails API Project by aaronbrethorst on Thursday November 22, 2012 @02:23PM (#4819740)
What's the easiest way to make this work well with the asset pipeline assuming I wanted to make a single page app hosted in the same project? Or should I just not do that?

edit: thanks, guys!

Re:Introducing the Rails API Project by bradgessler on Thursday November 22, 2012 @02:32PM (#4819761)
We used http://middlemanapp.com/ to build http://pollev.com/ (view this on a android or iPhone). Our entire mobile website compiles out into 3 files: JS, CSS, and a tiny html file.

This works out awesomely for a few reasons. First, our deploys for our mobile app is just rsync. No fancy cap scripts. Second, its super easy to put the mobile app behind a CDN.

One wrinkle in this approach is how to deal with dependencies between the Rails API and a completely separate JS app. We hack around that be packaging up our mobile app as a rubygem so that we can manage the dependencies through bundler.

I highly recommend this approach. Its a great way to separate out an API team from a front-end app team. All of our future apps are going to be written this way, including an HTML5 rewrite of all of our visualizations (from flash).

We plan on writing up a bunch of blog posts on the workflow, so stay tuned :)

Re:Introducing the Rails API Project by steveklabnik2 on Thursday November 22, 2012 @02:24PM (#4819745)
The asset pipline isn't removed, so you don't need to do anything special.

That said, I don't think that it's ideal for heavy JS apps. Lots of possible work that could be done in this area.

Re:Introducing the Rails API Project by irahul on Thursday November 22, 2012 @03:49PM (#4819941)
> That said, I don't think that it's ideal for heavy JS apps.

Rails-api churns out JSON, JS consumes it. I can think of performance being an issue.

What are the other issues?

Re:Introducing the Rails API Project by steveklabnik2 on Thursday November 22, 2012 @07:33PM (#4820557)
I've responded to your sibling.
Re:Introducing the Rails API Project by mahesh_rm on Thursday November 22, 2012 @04:25PM (#4820069)
Why don't you? Can you please elaborate on that? Thank you!
Re:Introducing the Rails API Project by steveklabnik2 on Thursday November 22, 2012 @07:33PM (#4820556)
Basically, as it stands, you have to put your {Ember,Backbone,..} app in `app/assets/javascripts/app/models`, for example, which is kinda crazy. I'd like to see JavaScript become an actual first-class citizen.

Also, the pipeline has been re-written for Rails 4, but historically it's been kinda slow and buggy.

For an example of what I'm thinking about, rake-pipeline-web is interesting.

Re:Introducing the Rails API Project by jurre on Thursday November 22, 2012 @04:06PM (#4819988)
I recently used http://yeoman.io/ for developing a backbone.js app, you can easily set it up to automatically compile (it uses Grunt internally) the individual sources to your rails apps public folder for development, and then compile/minify/concatenate your files for production. Worked quite well for me.