Stephen Eley <[email protected]> writes:

> On Tue, Feb 3, 2009 at 2:41 AM, cool <[email protected]> wrote:
>>
>> I want to use like "admin.domain.com"
>>   if the subdomain is "admin" it should not go to the above routes
>> that i have mentioned .
>>  How can i do that?
>>   I am struck with this ?
>
> This one's pretty straightforward.  Just put a rule above the other
> ones to the effect of:
>
> match(:subdomain => 'admin').to(:controller => 'admin') do
>   [any additional route rules within the admin subdomain]
> end

I wasn't able to get that to work, so I ended up doing this:

r.match('/').defer_to do |request, params|
 if request.subdomains[0] != 'playground' && request.subdomains[0].to_i != 127
   params.merge :controller => 'stories', :action => 'show',
   :short_title => request.subdomains[0]
 else
   params.merge :controller => 'site', :action => 'show'
 end
end

(The != 127 is for when I'm running merb in development, where the host
is 127.0.0.1).

Shalon Wood

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to