Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Jorge Dominguez
Jorge Dominguez
12,632 Points

How to create Subdomains under blog tittle? (for example)

I am trying to create this with http://railscasts.com/episodes/221-subdomains-in-rails-3?autoplay=true

But with rails 3 and rails 4 is dont work by my side...

any help?

as so from RichOnRails https://richonrails.com/articles/basic-subdomains-in-ruby-on-rails and then ck the reg rails docs too http://guides.rubyonrails.org/routing.html

SubdomainsExample::Application.routes.draw do
  resources :posts
  resources :blogs

  match '/', to: 'blogs#index', constraints: { subdomain: 'www' }, via: [:get, :post, :put, :patch, :delete]
  match '/', to: 'blogs#show', constraints: { subdomain: /.+/ }, via: [:get, :post, :put, :patch, :delete]

  root to: "blogs#index"