github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

penguincoder / acts_as_restricted_subdomain

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 28
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Allows a Rails application to run multiple subdomain sites transparently inside of a single Rails instance. This allows for multi-homed or multi-tenant databases very easily. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Allow for strings and symbols to set the current subdomain in the 
subdomain class by finding by the column name and finding the first 
result. 
penguincoder (author)
Thu Jan 21 12:42:39 -0800 2010
commit  a12b21dea738ea0dc87d8302945917671a1cd454
tree    85f38cb0f5fa7a3ddcc6b501be5d88c7a849f5da
parent  43fcdc64e9f1790419b9a2099efb3ae80d7c63d2
acts_as_restricted_subdomain /
name age
history
message
file LICENSE Mon Jun 01 14:16:37 -0700 2009 adding plugin to github hotness [Andrew Coleman]
file README Mon Jun 01 14:16:37 -0700 2009 adding plugin to github hotness [Andrew Coleman]
file init.rb Mon Jun 01 14:16:37 -0700 2009 adding plugin to github hotness [Andrew Coleman]
directory lib/ Thu Jan 21 12:42:39 -0800 2010 Allow for strings and symbols to set the curren... [penguincoder]
README
Subdomain Restrictions

A general purpose plugin for limiting a model to a subdomain by way of an
ActiveRecord model. This is a three pronged approach.

The controller must find the specified model, and raises a 404 if it is not
found. It also sets the current subdomain into the model for all later access.

The model side of things will restrict all finds to the scope of the
subdomain, if you want. It's a salt-shaker approach. You know, you salt
your beans and potatoes but not your steak. It will validate that the
association exists for all salted models, too.

For convienence, it also provides a looping iterator to evaluate your entire
Rails application in the scope of each defined subdomain. Just give it a
block and it will do whatever you want for each site in turn.

The last bit is the session. The session gets all access automatically
scoped to a subhash keyed on the subdomain as a symbol. That way you can
log into a site named 'foo' and not be logged into 'bar'.

For a final bit of hotness, when you run a script/console session, there will
be no restrictions placed on your actions unless you manually call
YourSubdomain.current = YourSubdomain.find_by_code 'somesite'
This way you can manually adminster all of the models without any hassle.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server