# Deliver different content by user agent and host

**URL:** <https://www.ruby-forum.com/t/deliver-different-content-by-user-agent-and-host/111806>\
**Category:** Rails\
**Created:** [August 11, 2007, 2:51am UTC](https://www.ruby-forum.com/t/deliver-different-content-by-user-agent-and-host/111806 "2007-08-11T02:51:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwerty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/4491bb/32.png) [@qwerty](https://www.ruby-forum.com/u/qwerty)\
**Post date:** [August 11, 2007, 2:51am UTC](https://www.ruby-forum.com/t/deliver-different-content-by-user-agent-and-host/111806/1 "2007-08-11T02:51:52Z")

</div>

Hi to all,

I’m currently working on a project that should share the db but could be  
accesed throw different domains, ie: [www.site1.com](http://www.site1.com), [www.site2.com](http://www.site2.com), etc.  
My  
question here is how to use different views depending on the site it’s  
requested, I know about request.host, I’m just wondering about a “clean”  
way  
of doing it.

Another layer of complex is that I need to send different content based  
on  
the user agent of the client, this is for host WML and HTML versions of  
the  
site.

Thanks,  
Angel

---

<div class="post-metadata">

**Author:** ![qwerty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/4491bb/32.png) [@qwerty](https://www.ruby-forum.com/u/qwerty)\
**Post date:** [August 11, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/deliver-different-content-by-user-agent-and-host/111806/2 "2007-08-11T13:02:29Z")

</div>

Im not an expert on this sort of things, but wouldn’t it be smarter to  
use a shared database server and then connect to it from both sites,  
that way rendering/using different applications/views. Thoughts?

---

<div class="post-metadata">

**Author:** ![qwerty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/4491bb/32.png) [@qwerty](https://www.ruby-forum.com/u/qwerty)\
**Post date:** [August 12, 2007, 2:35am UTC](https://www.ruby-forum.com/t/deliver-different-content-by-user-agent-and-host/111806/3 "2007-08-12T02:35:50Z")

</div>

Yep, I think it’s the best too, but I just wanted to know how is the  
other  
option to compare it.

Also I still need to solve the issue about many user agents :S

Thanks,  
Angel

2007/8/11, Glimjaur [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
