No commit activity in last 3 years
No release in over 3 years
Account subdomain gem add the functionality of adding and managing the subdomain functionality in rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 4.0
 Project Readme

AccountSubdomain

Adds the subdomain functionality to rails application. Ready for rails 4(RubyGems)

Dummy Application

Install

Gemfile (Rails 4)

gem 'account_subdomain'

Console

bundle
rails generate account_subdomain:install
rake db:migrate

Extend your Routes for mount ACCOUNT SUBDOMAIN

mount AccountSubdomain::Engine => "/account_subdomain"

You are done !

Usage

Account subdomain gem add the functionality of adding and managing the subdomain functionality in rails application.

It gives you some filters and ui helpers

subdomain

It return the subdomain from the request object

validate_subdomain

It validated the request subdomain. If subdomain not found then return to the redirect url mentioned in account_subdomain.rb under initializers.

current_subdomain

Return the valid subdomain else nil.

Settings

Setting for account subdomain mentioned in account_subdomain.rb under initializers

UI Helper

url_for

We override the default url_for helper now it supports the subdomain option to generate the url. example:-

   articles_url(:subdomain => 'test') #=> test.example.com/articles

   article_url(article, :subdomain => 'test') #=> test.example.com/articles/1