Follow Along as I Stumble on the Path to Learning RoR

Posts tagged “subdomain

Testing with Subdomain_Fu

I’m using Subdomain_Fu and was having issues because I didn’t know how to specify the current_subdomain.

Then I found this post on StackOverflow (Groxx):

I added this to the top of my RSpec specs:

def in_subdomain(str) = “#{str}”

then I set my subdomains in each test with the in_subdomain method:

it “should find index” do
in_subdomain(whatever your subdomain is)
get :index



Subdomains, Locally

In order to make subdomains work locally, I had to change my local host files to map the url correctly (used subdomain fu gem).

Here’s how to find the hosts file (c:\windows\system32\drivers\etc\hosts):



here are some tutorials on making subdomains work in Rails 3.0


if you want to test this locally, you need to edit your hosts file:


for windows users: