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?
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’]