Git Product home page Git Product logo

request_routing's Introduction

Request Routing Plugin for Ruby on Rails
========================================
(c) Dan Webb 2006 ([email protected])

Plugin that allows you to define routing conditions that test 
methods/properties of the request object such as subdomain, domain,
port.  You can test them either against a value or with a Regexp
(assuming the method returns a string)

*UPDATE* Now works with the new routing code as implemented in edge rails.  Note the
change in API: use :conditions instead of :requirements.

== Installation

    ruby script/plugin install http://svn.vivabit.net/external/rubylibs/request_routing/

== Usage

In routes.rb you can specify use the :requirements hash with request properties:

    map.connect '', :controller => 'main', :conditions => { :subdomain => 'www' }

    map.connect 'admin', :controller => 'admin', :conditions => { :remote_ip => /^127\.0\.0\.[0-9]$/ }

You can also, of course, use the conditions hash in map.with_options calls.

The allowed properties are:

		:subdomain  (only checks the first subdomain)
		:domain (only accurate for single tld domain names at the moment)
		:method (a symbol)
		:port (a number)
		:remote_ip 
		:content_type (content type of the post body)
		:accepts 
		:request_uri (the entire request uri)
		:protocol (either http:// or https://)

request_routing's People

Contributors

zachhale avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.