Do I mount rack apps in Rails (3.1) for faster APIs?


I’m not sure I fully appreciate the best use(s) for Rack apps (e.g.,
Sinatra apps) in a Rails (3.1) application…

Scenario: I have in mind a bunch of RESTful controller actions linked
to models – all for providing an API.

Approach 1: handle each resource from its own mounted Rack app:

  • ‘Rails 3 in Action’ advises mounted rack apps for Rails APIs because
    they are faster
  • If I ever decide to split out the resources into their own
    individual rack apps, I will have the rack server code and associated
    tests already written

Approach 2: ignore the mounted app approach and separate out common
controller behavior into an ActionController mixin and associated
tests and configure for each resource

  • I’ve done this before, so I know it works, and won’t take as much
    time as Approach 1, which will be new to me

Any thoughts?



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs