It worked now. I''ve read somewhere that I have to use collection_select
if I
want to retrieve data from the DB so I was struggling with
collection_select, now I did it with ''select'', I stored the
data in the
controller in an array like:
def new
@user = User.find(logged_in_user)
@sending_options =[@user.username, @user.mobile_number,
''DOMAIN.COM'']
end
in the veiw:
<%= f.select :sender, @sending_options, :class =>
''fieldcell'' %>
That''s it :)
2008/6/14 AN@S <anas.marrawi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> Hi,
> I have a table called ''users'', there is a field called
''username'' and
> another field called ''mobile_number'' (among other
fields).
> In my application the user can send SMS message and can choose between
> his/her username and mobile number as the sender id. Both of them are of
> course stored in the users table. Also there is a third option which is the
> domain name of the website, it should be a static value (not retrieved from
> the database)
>
> I need to create a drop down select menu that enables the user to do that,
> I''ve spent a lot of time with collection_select but
couldn''t get it to work.
> Anyone can help me with this?
>
> Regards
>
>
--
Anas Marrawi
Visit me at: www.anasonline.net
If you want to send me encrypted emails. My public key: pub:13427489:17
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---