Forum: Ruby on Rails Rails 1.1, Markaby, options_from_collection

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3fdda7e032a5619199486d05b506ced4?d=identicon&s=25 Brad Daily (bdaily)
on 2006-03-30 21:27
Last night, I upgraded one of my rails apps to 1.1. This app uses
Markaby exclusively for its' views, and once I checked out the latest
revisiong of Markaby (r33), everything was working fine except for one
thing:

select_tag('province_id', options_from_collection_for_select(@provinces,
"id", "name"))

Now returns this (as you see it is spitting out the options both before
and after the opening select tag):

&lt;option value="2"&gt;Alberta&lt;/option&gt;<br />
&lt;option value="1"&gt;British Columbia&lt;/option&gt;<br />
&lt;option value="5"&gt;Manitoba&lt;/option&gt;<br />
&lt;option value="8"&gt;New Brunswick&lt;/option&gt;<br />
&lt;option value="9"&gt;Newfoundland&lt;/option&gt;<br />
&lt;option value="12"&gt;Northwest Territories&lt;/option&gt;<br />
&lt;option value="7"&gt;Nova Scotia&lt;/option&gt;<br />
&lt;option value="13"&gt;Nunavut&lt;/option&gt;<br />
&lt;option value="6"&gt;Ontario&lt;/option&gt;<br />
&lt;option value="10"&gt;Prince Edward Island&lt;/option&gt;<br />
&lt;option value="3"&gt;Québec&lt;/option&gt;<br />
&lt;option value="4"&gt;Saskatchewan&lt;/option&gt;<br />
&lt;option value="11"&gt;Yukon Territory&lt;/option&gt;&lt;select
id="province_id" name="province_id"&gt;&lt;option
value="2"&gt;Alberta&lt;/option&gt;<br />
&lt;option value="1"&gt;British Columbia&lt;/option&gt;<br />
&lt;option value="5"&gt;Manitoba&lt;/option&gt;<br />
&lt;option value="8"&gt;New Brunswick&lt;/option&gt;<br />
&lt;option value="9"&gt;Newfoundland&lt;/option&gt;<br />
&lt;option value="12"&gt;Northwest Territories&lt;/option&gt;<br />
&lt;option value="7"&gt;Nova Scotia&lt;/option&gt;<br />
&lt;option value="13"&gt;Nunavut&lt;/option&gt;<br />
&lt;option value="6"&gt;Ontario&lt;/option&gt;<br />
&lt;option value="10"&gt;Prince Edward Island&lt;/option&gt;<br />
&lt;option value="3"&gt;Québec&lt;/option&gt;<br />
&lt;option value="4"&gt;Saskatchewan&lt;/option&gt;<br />
&lt;option value="11"&gt;Yukon Territory&lt;/option&gt;&lt;/select&gt;

Any Markaby users seeing this behavior? Using the same tag in an rhtml
view works as expected.
3fdda7e032a5619199486d05b506ced4?d=identicon&s=25 Brad Daily (bdaily)
on 2006-03-30 21:28
Ok, let's try that again:

<option value="2">Alberta</option>
<option value="1">British Columbia</option>
<option value="5">Manitoba</option>
<option value="8">New Brunswick</option>
<option value="9">Newfoundland</option>
<option value="12">Northwest Territories</option>
<option value="7">Nova Scotia</option>
<option value="13">Nunavut</option>
<option value="6">Ontario</option>
<option value="10">Prince Edward Island</option>
<option value="3">Québec</option>
<option value="4">Saskatchewan</option>
<option value="11">Yukon Territory</option><select id="province_id"
name="province_id"><option value="2">Alberta</option>
<option value="1">British Columbia</option>
<option value="5">Manitoba</option>
<option value="8">New Brunswick</option>
<option value="9">Newfoundland</option>
<option value="12">Northwest Territories</option>
<option value="7">Nova Scotia</option>
<option value="13">Nunavut</option>
<option value="6">Ontario</option>
<option value="10">Prince Edward Island</option>
<option value="3">Québec</option>
<option value="4">Saskatchewan</option>
<option value="11">Yukon Territory</option></select>
3fdda7e032a5619199486d05b506ced4?d=identicon&s=25 Brad Daily (bdaily)
on 2006-03-30 23:34
Just an update to this. This appears to be an issue with r33 of Markaby
in general, and appears in both Rails 1.1 and 1.0. I was able to get
things working well by exporting the tagged version 0.3 of Markaby into
my markaby folder in vendor/plugins.

svn export http://code.whytheluckystiff.net/svn/markaby/tags/0.3/
vendor/plugins/markaby/ --force

So far, so good....

Brad Daily wrote:
> Last night, I upgraded one of my rails apps to 1.1. This app uses
> Markaby exclusively for its' views, and once I checked out the latest
> revisiong of Markaby (r33), everything was working fine except for one
> thing:
>
> select_tag('province_id', options_from_collection_for_select(@provinces,
> "id", "name"))
>
> Now returns this (as you see it is spitting out the options both before
> and after the opening select tag):
>
> &lt;option value="2"&gt;Alberta&lt;/option&gt;<br />
> &lt;option value="1"&gt;British Columbia&lt;/option&gt;<br />
> &lt;option value="5"&gt;Manitoba&lt;/option&gt;<br />
> &lt;option value="8"&gt;New Brunswick&lt;/option&gt;<br />
> &lt;option value="9"&gt;Newfoundland&lt;/option&gt;<br />
> &lt;option value="12"&gt;Northwest Territories&lt;/option&gt;<br />
> &lt;option value="7"&gt;Nova Scotia&lt;/option&gt;<br />
> &lt;option value="13"&gt;Nunavut&lt;/option&gt;<br />
> &lt;option value="6"&gt;Ontario&lt;/option&gt;<br />
> &lt;option value="10"&gt;Prince Edward Island&lt;/option&gt;<br />
> &lt;option value="3"&gt;Québec&lt;/option&gt;<br />
> &lt;option value="4"&gt;Saskatchewan&lt;/option&gt;<br />
> &lt;option value="11"&gt;Yukon Territory&lt;/option&gt;&lt;select
> id="province_id" name="province_id"&gt;&lt;option
> value="2"&gt;Alberta&lt;/option&gt;<br />
> &lt;option value="1"&gt;British Columbia&lt;/option&gt;<br />
> &lt;option value="5"&gt;Manitoba&lt;/option&gt;<br />
> &lt;option value="8"&gt;New Brunswick&lt;/option&gt;<br />
> &lt;option value="9"&gt;Newfoundland&lt;/option&gt;<br />
> &lt;option value="12"&gt;Northwest Territories&lt;/option&gt;<br />
> &lt;option value="7"&gt;Nova Scotia&lt;/option&gt;<br />
> &lt;option value="13"&gt;Nunavut&lt;/option&gt;<br />
> &lt;option value="6"&gt;Ontario&lt;/option&gt;<br />
> &lt;option value="10"&gt;Prince Edward Island&lt;/option&gt;<br />
> &lt;option value="3"&gt;Québec&lt;/option&gt;<br />
> &lt;option value="4"&gt;Saskatchewan&lt;/option&gt;<br />
> &lt;option value="11"&gt;Yukon Territory&lt;/option&gt;&lt;/select&gt;
>
> Any Markaby users seeing this behavior? Using the same tag in an rhtml
> view works as expected.
3fdda7e032a5619199486d05b506ced4?d=identicon&s=25 Brad Daily (bdaily)
on 2006-03-31 07:11
Well after some help from _why, problem solved. Any helpers are
automatically output to the stream, so you have to change the call to:

select_tag('province_id',
@helpers.options_from_collection_for_select(@provinces, "id", "name"))

Brad Daily wrote:
>> Last night, I upgraded one of my rails apps to 1.1. This app uses
>> Markaby exclusively for its' views, and once I checked out the latest
>> revisiong of Markaby (r33), everything was working fine except for one
>> thing:
>>
>> select_tag('province_id', options_from_collection_for_select(@provinces,
>> "id", "name"))
This topic is locked and can not be replied to.