# Subdomains with subdomain\_fu

**URL:** <https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686>\
**Category:** Rails\
**Created:** [April 4, 2009, 12:33am UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686 "2009-04-04T00:33:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [April 4, 2009, 12:33am UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686/1 "2009-04-04T00:33:21Z")

</div>

Hi all,

I am bit stuck with subdomain\_fu plugin. I want to create a new  
subdomain for newcomers. e.g. [newband.mysite.net](http://newband.mysite.net)

I set the tld\_sizes:  
SubdomainFu.tld\_sizes = {:development =\> 0,  
:test =\> 0,  
:production =\> 2}

my routes.rb:

map.resources :bands  
map.band\_root ‘’, :controller =\> ‘bands’,  
:action =\> ‘show’,  
:conditions =\> { :subdomain =\> /.+/ }

bands controller:  
def show  
@current\_band = Band.find\_by\_subdomain(current\_subdomain)  
end

I always end up with “CANT FIND THE PAGE” error.  
ANy help would be most welcome.

P.

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [April 4, 2009, 10:58am UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686/2 "2009-04-04T10:58:45Z")

</div>

> **[emailMyName- Low-cost email address - 1GB email storage - Block spam - Web...](http://www.emailmyname.com/)**
>
> emailMyName personal email from mySite.com. Half the standard price of Yahoo! and Hotmail. With emailyMyName you get your name as your personal email address. emailMyName includes virtually unlimited storage - 1GB of storage (1024 MB email storage) -...

if thats the URL u want, then tld\_size should be 1.

newband.localhost:3000

if thats the URL you’re developing with, then tld\_size should be 0.

tld\_size = (number of dots in URL) - 1 (to put it crudely)

On Apr 4, 3:33 am, Petr B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [April 4, 2009, 12:23pm UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686/3 "2009-04-04T12:23:53Z")

</div>

Thx Ram,

my production server is [http://rails.mysite.com](http://rails.mysite.com)

so the example should be [http://newband.rails.mysite.com](http://newband.rails.mysite.com) =\> tld\_size 2  
should be fine.

Could it be the problem, that I didnt flush the cache?  
Or is there another problem?

Thx Petr

Ram wrote:

> [newband.mysite.net](http://newband.mysite.net)
> 
> if thats the URL u want, then tld\_size should be 1.
> 
> newband.localhost:3000
> 
> if thats the URL you’re developing with, then tld\_size should be 0.
> 
> tld\_size = (number of dots in URL) - 1 (to put it crudely)

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [April 4, 2009, 1:57pm UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686/4 "2009-04-04T13:57:05Z")

</div>

Here is the log file.

> <https://gist.github.com/90190>

Cant see the trouble, but I might be wrong.

Thank you.  
P.

> Ram wrote:

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [April 4, 2009, 1:05pm UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686/5 "2009-04-04T13:05:38Z")

</div>

Hi Petr,

To be very honest, I dont know whether not flushing the cache might  
cause trouble here.  
I just chipped in with what little i knew :).

You could check the dev/prodn log to get a better idea of whats going  
on and where things get stuck. You could also disable subdomains  
temporarily and make sure it IS indeed a subdomain problem in the  
first place.  
But most likely, the logs will be your best friends here. You will be  
able to trace the problem there the best. Do let us know what you find  
there. And ill chip in what I can if I can :).

On Apr 4, 3:23 pm, Petr B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [April 4, 2009, 6:04pm UTC](https://www.ruby-forum.com/t/subdomains-with-subdomain-fu/164686/6 "2009-04-04T18:04:39Z")

</div>

The Sites controller index action seems fine.  
The image show action though, seems to search for images with weird IDs  
(submenu-li and account here).  
You should make sure that link is correct and the required parameters  
are  
passed on correctly. and the route too is generated correctly.  
You might also want to get this line checked. This is probably the line  
throwing the page not found error. Hope that helps.

Rendering  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action\_controller/templates/rescues/layout.erb  
(not\_found)

On Sat, Apr 4, 2009 at 5:27 PM, Petr B.  
\<removed\_email\_address@domain.invalid

> wrote:

> > Ram wrote:  
> > –  
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
In Sport We Trust !!!
