Skip to content

Commit

Permalink
First working prototype, grabs current subdomain, is smart enough to …
Browse files Browse the repository at this point in the history
…know when you're running a localhost copy and will use the correct call to request.subdomains
  • Loading branch information
Jose Fernandez committed May 2, 2008
1 parent 00f439c commit 4084115
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
13 changes: 5 additions & 8 deletions README
@@ -1,13 +1,10 @@
Submarine
=========
=== Submarine

Introduction goes here.
Handy controller and helper methods to grab the current subdomain.

=== Instructions

Example
=======

Example goes here.
TODO

=== Copyright (c) 2008 Norbauer Inc, released under the MIT license
=== Written by Jose Fernandez and Ryan Norbauer, with support from The Sequoyah Group
=== Written by Jose Fernandez with support from The Sequoyah Group
1 change: 0 additions & 1 deletion init.rb
@@ -1 +0,0 @@
# Include hook code here
24 changes: 23 additions & 1 deletion lib/submarine.rb
@@ -1 +1,23 @@
# Submarine
module Submarine

mattr_writer :subdomain_model
def self.subdomain_model
@@subdomain_model ||= 'user'
end

mattr_writer :subdomain_column
def self.subdomain_column
@@subdomain_column ||= 'login'
end

def self.included(controller)
controller.helper_method(:current_subdomain)
end

protected

def current_subdomain
request.host.include?('localhost') ? request.subdomains(0).first : request.subdomains.first
end

end

0 comments on commit 4084115

Please sign in to comment.