README.rdoc in mbleigh-subdomain-fu-0.4.0 vs README.rdoc in mbleigh-subdomain-fu-0.5.3
- old
+ new
@@ -43,10 +43,24 @@
users_path(:subdomain => false) # => /users
In this way you can rest assured that you will never misdirect your links to the
same subdomain when you meant to change it.
+== Use in controllers and views
+
+You have access to current_subdomain and current_domain methods.
+
+current_subdomain - returns all subdomains.
+ Example for the URL http://awesome.website.stuff.example.com current_subdomain will return "awesome.website.stuff"
+
+current_domain - returns all subdomains except for the subdomain, including the TLD.
+ Example for the URL http://awesome.website.stuff.example.com current_subdomain will return "website.stuff.example.com"
+
+If what you really want is the entire domain, then use <tt>request.domain</tt> in
+your controllers. The purpose of current_domain is to only strip off the first
+subdomain, if any, and return what's left.
+
== Configuration
You may need to configure SubdomainFu based on your development setup. The
configuration required is:
@@ -80,13 +94,17 @@
== Routing
SubdomainFu can also work within Rails' routing for subdomain-specific routes. For instance, if you only wanted your administrative tools available in the "admin" subdomain you could add this to your routes.rb file:
- map.with_options :conditions => {:subdomain => 'admin} do |admin|
+ map.with_options :conditions => {:subdomain => 'admin'} do |admin|
admin.resources :posts
admin.resources :users
end
+
+In addition to specifying a string, you could also specify <tt>false</tt> to
+require no subdomain (this includes mirrors that you've set up such as www)
+or a regular expression to match a range of subdomains.
== Resources
* GitHub Repository: http://github.com/mbleigh/subdomain-fu
* RDocs: http://rdoc.info/projects/mbleigh/subdomain-fu