<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Find your Rails subdomains</title>
	<atom:link href="http://jonathanng.com/ruby-on-rails/find-your-rails-subdomains/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanng.com/ruby-on-rails/find-your-rails-subdomains/</link>
	<description>code + culture</description>
	<lastBuildDate>Fri, 21 Jan 2011 19:11:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: srinathbtech</title>
		<link>http://jonathanng.com/ruby-on-rails/find-your-rails-subdomains/comment-page-1/#comment-798</link>
		<dc:creator>srinathbtech</dc:creator>
		<pubDate>Mon, 02 Mar 2009 19:20:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonathansng.com/ruby-on-rails/find-your-rails-subdomains/#comment-798</guid>
		<description>Oops !! It&#039;s working great in my development/production environments..&lt;br&gt;you can ignore my comment&lt;br&gt;&lt;br&gt;thanks,&lt;br&gt;sri...</description>
		<content:encoded><![CDATA[<p>Oops !! It&#39;s working great in my development/production environments..<br />you can ignore my comment</p>
<p>thanks,<br />sri&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srinathbtech</title>
		<link>http://jonathanng.com/ruby-on-rails/find-your-rails-subdomains/comment-page-1/#comment-706</link>
		<dc:creator>srinathbtech</dc:creator>
		<pubDate>Mon, 02 Mar 2009 11:20:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonathansng.com/ruby-on-rails/find-your-rails-subdomains/#comment-706</guid>
		<description>Oops !! It&#039;s working great in my development/production environments..&lt;br&gt;you can ignore my comment&lt;br&gt;&lt;br&gt;thanks,&lt;br&gt;sri...</description>
		<content:encoded><![CDATA[<p>Oops !! It&#39;s working great in my development/production environments..<br />you can ignore my comment</p>
<p>thanks,<br />sri&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srinathbtech</title>
		<link>http://jonathanng.com/ruby-on-rails/find-your-rails-subdomains/comment-page-1/#comment-698</link>
		<dc:creator>srinathbtech</dc:creator>
		<pubDate>Sat, 14 Feb 2009 06:35:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonathansng.com/ruby-on-rails/find-your-rails-subdomains/#comment-698</guid>
		<description>This is not working for me &lt;br&gt;showing &quot;nil&quot; , I&#039;m using rails 1.2.3 with mongrel server in dev mode.&lt;br&gt;My code looks like this in production/development :&lt;br&gt;&lt;br&gt;in routes.rb&lt;br&gt;&lt;br&gt;  map.connect &#039;&#039;, :controller =&gt; &quot;account&quot;, :action =&gt; &quot;login&quot;, :conditions =&gt; {:domain =&gt; &quot;tokyo.com&quot;}&lt;br&gt;&lt;br&gt;in environment.rb&lt;br&gt;&lt;br&gt;module ActionController&lt;br&gt;  module Routing&lt;br&gt;    class RouteSet&lt;br&gt;      def extract_request_environment(request)&lt;br&gt;        { :method =&gt; request.method, :domain =&gt; request.domain}&lt;br&gt;      end&lt;br&gt;    end&lt;br&gt;    class Route&lt;br&gt;      alias_method :old_recognition_conditions, :recognition_conditions&lt;br&gt;      def recognition_conditions&lt;br&gt;        result = old_recognition_conditions&lt;br&gt;        result &lt;&lt; &quot;conditions[:domain] === env[:domain]&quot; if conditions[:domain]&lt;br&gt;        result&lt;br&gt;      end # def&lt;br&gt;    end # class Route&lt;br&gt;  end # module Routing&lt;br&gt;end # module ActionController&lt;br&gt;&lt;br&gt;&lt;br&gt;i registered subdomain name as &quot;sub.tokyo.com&quot; for domain &quot;tokyo.com&quot; to provide different templates based on request url.&lt;br&gt;&lt;br&gt;in application.rb i used :&lt;br&gt;&lt;br&gt;def check_domain&lt;br&gt;  if request.domain == &quot;tokyo.com&quot;&lt;br&gt;     return true&lt;br&gt;  elsif request.subdomains.first == &quot;sub&quot;&lt;br&gt;       return false&lt;br&gt;  end&lt;br&gt;end&lt;br&gt;&lt;br&gt; In development i configure /etc/hosts too&lt;br&gt;127.0.0.1 : localhost&lt;br&gt;127.0.0.1 : &lt;a href=&quot;http://tokyo.com&quot; rel=&quot;nofollow&quot;&gt;tokyo.com&lt;/a&gt;&lt;br&gt;127.0.0.1 : &lt;a href=&quot;http://sub.tokyo.com&quot; rel=&quot;nofollow&quot;&gt;sub.tokyo.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;could you help me to fetch my sub domain &lt;br&gt;is return nil when puts request.subdomains.first&lt;br&gt;&lt;br&gt;thanks&lt;br&gt;sri..</description>
		<content:encoded><![CDATA[<p>This is not working for me <br />showing &#8220;nil&#8221; , I&#39;m using rails 1.2.3 with mongrel server in dev mode.<br />My code looks like this in production/development :</p>
<p>in routes.rb</p>
<p>  map.connect &#39;&#39;, :controller =&gt; &#8220;account&#8221;, :action =&gt; &#8220;login&#8221;, :conditions =&gt; {:domain =&gt; &#8220;tokyo.com&#8221;}</p>
<p>in environment.rb</p>
<p>module ActionController<br />  module Routing<br />    class RouteSet<br />      def extract_request_environment(request)<br />        { :method =&gt; request.method, :domain =&gt; request.domain}<br />      end<br />    end<br />    class Route<br />      alias_method <img src='http://jonathanng.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ld_recognition_conditions, :recognition_conditions<br />      def recognition_conditions<br />        result = old_recognition_conditions<br />        result &lt;&lt; &#8220;conditions[:domain] === env[:domain]&#8221; if conditions[:domain]<br />        result<br />      end # def<br />    end # class Route<br />  end # module Routing<br />end # module ActionController</p>
<p>i registered subdomain name as &#8220;sub.tokyo.com&#8221; for domain &#8220;tokyo.com&#8221; to provide different templates based on request url.</p>
<p>in application.rb i used :</p>
<p>def check_domain<br />  if request.domain == &#8220;tokyo.com&#8221;<br />     return true<br />  elsif request.subdomains.first == &#8220;sub&#8221;<br />       return false<br />  end<br />end</p>
<p> In development i configure /etc/hosts too<br />127.0.0.1 : localhost<br />127.0.0.1 : <a href="http://tokyo.com" rel="nofollow">tokyo.com</a><br />127.0.0.1 : <a href="http://sub.tokyo.com" rel="nofollow">sub.tokyo.com</a></p>
<p>could you help me to fetch my sub domain <br />is return nil when puts request.subdomains.first</p>
<p>thanks<br />sri..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

