# Same partial different results

**URL:** <https://discuss.rubyonrails.org/t/same-partial-different-results/49173>\
**Category:** rubyonrails-talk\
**Created:** [February 7, 2010, 2:26am UTC](https://discuss.rubyonrails.org/t/same-partial-different-results/49173 "2010-02-07T02:26:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianp](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@brianp](https://discuss.rubyonrails.org/u/brianp)\
**Post date:** [February 7, 2010, 2:26am UTC](https://discuss.rubyonrails.org/t/same-partial-different-results/49173/1 "2010-02-07T02:26:16Z")

</div>

Hey everyone.

I'm using a partial 3 times in my applications.html.erb file. When the index is loaded everything works exactly like it should. (the partial contains a collection\_select with prompts). If i goto the show action the options for the collection select seem to vanish. IE no prompt when rendered.

I've removed everything from the show.html.erb and def show action just incase there was some sort of run in. But there isn't, it seems to just be a rendering problem.

Any ideas?

The partial: Select \<%= box %\>: \<%= collection\_select("vehicle", box, list, box, box, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:prompt =\> "Search by #{box}", :selected =\> selected }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:onchange =\> "#{remote\_function(:url =\> {:action =\> "update\_dropdowns"}, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:with =\> "'current\_id='+id+

'&current\_value='+value+

'&fields='+

'year='+$(vehicle\_year).value+','+

'make='+$(vehicle\_make).value+','+

'model='+$(vehicle\_model).value")}"}) %\>

---

<div class="post-metadata">

**Author:** ![brianp](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@brianp](https://discuss.rubyonrails.org/u/brianp)\
**Post date:** [February 7, 2010, 11:19pm UTC](https://discuss.rubyonrails.org/t/same-partial-different-results/49173/2 "2010-02-07T23:19:27Z")

</div>

So it turns out it's not just the partial. Any dropdown select i ad to that page will not properly display :prompt. Now I have an ajax update method so If i change the select all selects are reloaded. And as soon as I change one they all act accordingly with prompt displayed properly.

So it seems only the inital page load is messing up the rendering.

Anyone have any ideas?

Even a method to force reload that container on load so it would properly adjust would be decent.

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [February 8, 2010, 9:43am UTC](https://discuss.rubyonrails.org/t/same-partial-different-results/49173/3 "2010-02-08T09:43:23Z")

</div>

Two suggestions, firstly have a look at the html of the page (View, Page Source, or similar, in browser) and see if the prompt is there. If it is then copy and paste the code into the w3c html validator at [The W3C Markup Validation Service](http://validator.w3.org/#validate_by_input) and see if there are any errors.

Colin

---

<div class="post-metadata">

**Author:** ![brianp](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@brianp](https://discuss.rubyonrails.org/u/brianp)\
**Post date:** [February 9, 2010, 8:07am UTC](https://discuss.rubyonrails.org/t/same-partial-different-results/49173/4 "2010-02-09T08:07:55Z")

</div>

Hey Colin, thanks for the reply.

I did think to check for that and un-fortunately the html for the prompt (first \<option\>) is not generated at all. It immediately skips to the first object in the list, just as if the prompt wasn't there at all.

---

<div class="post-metadata">

**Author:** ![brianp](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@brianp](https://discuss.rubyonrails.org/u/brianp)\
**Post date:** [February 9, 2010, 8:38am UTC](https://discuss.rubyonrails.org/t/same-partial-different-results/49173/5 "2010-02-09T08:38:08Z")

</div>

Just found my problem.

\<%= collection\_select(:Vehicle, box, list, box, box,

I previously had :vehicle. Which I'm assuming wasn't actually being recognized as Model type due to case. Weird that it still functioned on the index but broke on the show.

Either way it works now. Weird little glitch I guess. I could understand if it didn't work at all lol.

Thanks for the suggestion Colin!
