Here is an interesting behavior that I have noticed is rather common
with R0R. I have two select helpers being used in a form. Both are
supposed to display a list of stuff, but if either should already have
an item in that list accosiated with a value in the table it should
display that value in the list. However, one does and one does not. Here
is the code:
<%= select ''bar'', ''account_id'',
Account.find_by_sql( "SELECT
accounts.accountcode ||'' ''|| accounts.name AS accountcode,
id from
accounts
ORDER BY accounts.accountcode ASC" ).collect{ |a| [a.accountcode,
a.id] }, :selected => @bar.account_id %>
This one works perfectly well and display the correct selected item.
<%= select ''enpseudo'', ''pseudocity'',
Enpseudo.find( :all ).collect{ |a|
[a.pseudocity, a.id] }, :selected => @enpseudo.pseudocity %>
This one, however, does not display the correct item in the list if one
is aleardy present in the table. I have checked the output and the
output it gives does indeed match an item in the list but it is
odviously not making the accassiation. Any suggestions of what I am
doing wrong? Thanks
-Shandy
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---