# :url being ignored or routing problem?

**URL:** <https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622>\
**Category:** Rails\
**Created:** [August 3, 2010, 8:21am UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622 "2010-08-03T08:21:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 3, 2010, 8:21am UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/1 "2010-08-03T08:21:51Z")

</div>

background  
i have a page with a drop-down menu item. if any of the choices is  
selected, a partial gets activated to appear with new drop-down menu  
choices. the initial page uses a select\_tag, observe\_field, and a div  
to implement the above desired functionality. the pages i am working  
with comprise a sub/child area within an “admin” area. this all used  
to work, but for some reason stopped work at some unknown time.

troubleshooting  
i’m looking at the log, and it seems to me that when i am at the  
initial page (and surrounding pages), i am in the desired controller.  
routing appears to be working as expected. however, when i test my  
drop-down menu, it appears as though 1) the :url =\> {:controller =\> …  
details are being ignored; and 2) the parent “admin” controller only  
is getting processed rather than the supposed current “admin/assets”  
controller. it is as if the default, last route, " map.connect  
‘:controller/:action/:id’ " is being consulted rather than the :url in  
observe\_field or anything else higher pertaining to admin and assets  
in routes. “assets” gets parsed as/demoted to an action rather than  
as part of the controller.

\<%= select\_tag(:type, options\_for\_select([’[select  
one]’,‘page’,‘program’,‘event’]), :id =\> ‘type\_selection’) %\>

\<%= observe\_field(‘type\_selection’,  
:frequency =\> 0.5,  
:update =\> ‘page\_selection’,  
:url =\> {:controller =\> “admin/assets”, :action =\> :set\_pages},  
:with =\> “‘type=’+$(‘type\_selection’).value”) %\>

set\_pages is defined as a method in the admin/assets controller.

questions  
what (routing) is taking precedence? where is observe\_field getting  
its instructions from instead, why does it seem as if its :url  
argument is being ignored?

i’ve performed the usual basic tasks, such as restarting the  
application, etc. but obviously i’m missing something… probably  
something very basic 😕 please advise.

---

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 3, 2010, 12:30pm UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/2 "2010-08-03T12:30:02Z")

</div>

On Aug 2, 11:15 pm, suzuki [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> observe\_field or anything else higher pertaining to admin and assets  
> :with =\> “‘type=’+$(‘type\_selection’).value”) %\>

What is in the rendered html?

Fred

---

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 4, 2010, 3:45am UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/3 "2010-08-04T03:45:12Z")

</div>

if i understand your question properly, i get a page with a partial,  
where the partial area displays a 404 error (“The page you were  
looking for doesn’t exist. You may have mistyped the address or the  
page may have moved.”) i expect (but don’t want!) this, since routing  
is parsing my intentions all wrong, as described earlier.

---

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 4, 2010, 11:10am UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/4 "2010-08-04T11:10:06Z")

</div>

On 4 August 2010 02:43, suzuki [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> if i understand your question properly, i get a page with a partial,  
> where the partial area displays a 404 error (“The page you were  
> looking for doesn’t exist. You may have mistyped the address or the  
> page may have moved.”) i expect (but don’t want!) this, since routing  
> is parsing my intentions all wrong, as described earlier.

Please don’t top post, it is easier to follow the thread if you insert  
your reply at the appropriate point.  
I think Fred wants to see the html of the page, you can see this using  
View, Page Source (or similar) in the browser.

You can check that the html is valid (a good thing to check first when  
strange things happen) by copying the complete html from the View  
Source window and pasting it into the w3c html validator web site.

Colin

Colin

---

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 4, 2010, 5:09pm UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/5 "2010-08-04T17:09:39Z")

</div>

> > in routes. “assets” gets parsed as/demoted to an action rather than
> 
> > 
> 
> What is in the rendered html?

---

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 4, 2010, 12:01pm UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/6 "2010-08-04T12:01:37Z")

</div>

On Aug 4, 2:43 am, suzuki [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> if i understand your question properly, i get a page with a partial,  
> where the partial area displays a 404 error (“The page you were  
> looking for doesn’t exist. You may have mistyped the address or the  
> page may have moved.”) i expect (but don’t want!) this, since routing  
> is parsing my intentions all wrong, as described earlier.

That’s not what I meant. What I meant is what html does observe\_field  
produce

Fred

---

<div class="post-metadata">

**Author:** ![codecrafted](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@codecrafted](https://www.ruby-forum.com/u/codecrafted)\
**Post date:** [August 4, 2010, 5:43pm UTC](https://www.ruby-forum.com/t/url-being-ignored-or-routing-problem/192622/7 "2010-08-04T17:43:36Z")

</div>

On Aug 4, 4:08 pm, suzuki [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

so that much seems ok - your url option isn’t getting ignored since  
the javascript is trying to post to /admin/assets/set\_pages (which  
from your description sounds correct)

which controller is picking this up (and which one should be picking  
it up) ?

Fred
