Hello, I am trying to implement the subdomains on my app. I am using rails 3.1.rc5. The problem is that "constraints" in my route.rb does not work and i am redirected to my app root. However if I use "constraint" (singular), my subdomain is parsed and i am succesfully routed to the show action of the controller i wanted (SchoolsController). The problem with this is that when i do not use a subdomain and therefore wish to be redirected to the root of my app, i get an "ActiveRecord::RecordNotFound" because it cannot find a School with that subdomain.
ok, I managed to fix it. I had to tell rails to load my lib directory in my
config/application.rb
file by adding these lines:and using:
in my
routes.rb
Hope this helps
Hello, I am trying to implement the subdomains on my app. I am using rails 3.1.rc5. The problem is that "constraints" in my route.rb does not work and i am redirected to my app root. However if I use "constraint" (singular), my subdomain is parsed and i am succesfully routed to the show action of the controller i wanted (SchoolsController). The problem with this is that when i do not use a subdomain and therefore wish to be redirected to the root of my app, i get an "ActiveRecord::RecordNotFound" because it cannot find a School with that subdomain.
Anybody else having a similar issue? any ideas?