Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jamiebrittain/rails-api
base: master
...
head fork: wintery/rails-api
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 9 commits
  • 4 files changed
  • 0 commit comments
  • 5 contributors
View
4 .travis.yml
@@ -0,0 +1,4 @@
+rvm:
+ - 1.9.3
+notifications:
+ email: false
View
5 README.md
@@ -1,5 +1,7 @@
# Rails::API
+[![Build Status](https://secure.travis-ci.org/spastorino/rails-api.png?branch=master)](http://travis-ci.org/spastorino/rails-api)
+
**Rails::API** is a subset of a normal Rails application, created for applications that don't require all functionality that a complete Rails application provides. It is a bit more lightweight, and consequently a bit faster than a normal Rails application. The main example for its usage is in API applications only, where you usually don't need the entire Rails middleware stack nor template generation.
## Using Rails for API-only Apps
@@ -185,14 +187,13 @@ All Action Controller modules know about their dependent modules, so you can fee
Some common modules you might want to add:
* *AbstractController::Translation*: Support for the *l* and *t* localization and translation methods. These delegate to *I18n.translate* and *I18n.localize*.
-* *ActionController::HttpAuthentication::Basic* (or *Digest* or *Token*): Support for basic, digest or token HTTP authentication.
+* *ActionController::HttpAuthentication::Basic::ControllerMethods* (or *Digest* or *Token*): Support for basic, digest or token HTTP authentication.
* *AbstractController::Layouts*: Support for layouts when rendering.
* *ActionController::MimeResponds*: Support for content negotiation (*respond_to*, *respond_with*).
* *ActionController::Cookies*: Support for *cookies*, which includes support for signed and encrypted cookies. This requires the cookie middleware.
The best place to add a module is in your *ApplicationController*. You can also add modules to individual controllers.
-
## Contributing
1. Fork it
View
1  lib/rails-api/action_controller/api.rb
@@ -99,6 +99,7 @@ def wrap_parameters(*); end
def helpers_path=(*); end
def allow_forgery_protection=(*); end
def helper_method(*); end
+ def helper(*); end
end
extend Compabitility
View
11 lib/rails-api/application.rb
@@ -11,7 +11,7 @@ def default_middleware_stack
end
if config.force_ssl
- middleware.use ::ActionDispatch::SSL, config.ssl_options
+ middleware.use ssl_module, config.ssl_options
end
if config.action_dispatch.x_sendfile_header.present?
@@ -64,6 +64,15 @@ def add_resource_route
private
+ def ssl_module
+ if defined? ::ActionDispatch::SSL
+ ::ActionDispatch::SSL
+ else
+ require 'rack/ssl'
+ ::Rack::SSL
+ end
+ end
+
def setup_generators!
generators = config.generators

No commit comments for this range

Something went wrong with that request. Please try again.