L
L
LoveCode &Coffe2019-09-16 17:47:20
Ruby on Rails
LoveCode &Coffe, 2019-09-16 17:47:20

How to output values ​​from db to rails select tag?

I'm trying to select all the names from the user table, which will then fall into the task table as executors
, here is the select code

<%= f.select :assignee , options_for_select(User.all,  :name) %>

But I get the values ​​as a hash 5d7fa0979872f143337347.pngalt="image"/> how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alekseiev, 2019-09-16
@LoveCode &Coffe

User.pluck(:name)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question