simpleweb/simple-constraints

Name: simple-constraints

Owner: Simpleweb

Description: Rails routing constraints

Created: 2013-02-01 16:06:15.0

Updated: 2014-02-14 10:22:04.0

Pushed: 2014-02-14 10:22:03.0

Homepage:

Size: 259

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Simple Constraints

Routing constraints are automatically included in the Rails router.

Installation

Add this line to your application's Gemfile:

gem 'simple-constraints'

And then execute:

$ bundle
 Subdomain

The subdomain constraint allow you to specify routes that should only be applied for certain subdomains. The :only option will only match the subdomains given, the :except option won't match the given subdomains. There is also a :tld_length (should be 1 for .com, 2 for .co.uk etc) which defaults to 1.

Application.routes.draw do
bdomain only: 'blog' do
resources :posts
d

bdomain except: ['www', 'mail'] do
resources :spaces
root to: 'spaces#index'
d

ot to: 'pages#home'

Contributing
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.