# Distinguishing mapped urls from ordinary action urls

**URL:** <https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884>\
**Category:** Rails\
**Created:** [April 12, 2006, 11:08pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884 "2006-04-12T23:08:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:08pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/1 "2006-04-12T23:08:31Z")

</div>

I want to present different view depending on the url.  
example below:

[http://myapp/start/show?url=xZq](http://myapp/start/show?url=xZq)  
[http://myapp/xZq](http://myapp/xZq)

both addresses are controlled by a single controller and the same  
action.  
the second url is only mapped in routes.rb

how can I distinguished the mapped url and present a slightly different  
view  
in it?

Sabon

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:11pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/2 "2006-04-12T23:11:34Z")

</div>

in your mapping you can pass a parameter that will indicate this is a  
mapped  
link…

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:14pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/3 "2006-04-12T23:14:38Z")

</div>

I want the mapped url to be as short as possible, so passing a parameter  
in  
the url itself is out of the question.  
unless there’s some other way I’m not aware of.

thanks for reply.

Sabon

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:20pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/4 "2006-04-12T23:20:50Z")

</div>

I was meaning something like this

map.connect ‘:link’, :controller =\> ‘start’, :action =\> ‘show’, :url  
=\> :link, :mapped =\> ‘1’

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:42pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/5 "2006-04-12T23:42:13Z")

</div>

I assume :mapped will be stored in the @params?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:57pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/6 "2006-04-12T23:57:26Z")

</div>

works like charm,  
thanks a lot.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 11:48pm UTC](https://www.ruby-forum.com/t/distinguishing-mapped-urls-from-ordinary-action-urls/93884/7 "2006-04-12T23:48:17Z")

</div>

Yup, as @params[:mapped]
