0

I have a form on which I need to arrange an input field for entering a comment (type string) or select from predefined comments (select fields). How i can do this? Can i write comment into select field from keyboard and save it in db?

2 Answers2

0

There are two ways to do this

  1. You can use [simple_enum][1] gem to predefined all comment values and then render it in view. [1]: https://rubygems.org/gems/simple_enum
  2. You can create one table and save all the predefined comments and load it through active record query.
Ashish Jambhulkar
  • 1,374
  • 2
  • 14
  • 26
0

i find an answer in this https://stackoverflow.com/a/11898865/7437218 example:

<datalist id="cars">
  <option>Volvo</option>
  <option>Saab</option>
  <option>Mercedes</option>
  <option>Audi</option>
</datalist>

i can get option for datalist from model with predefined comments