Rails Model without a table

后端 未结 5 1081
你的背包
你的背包 2020-12-05 02:24

I want to create a select list for lets say colors, but dont want to create a table for the colors. I have seen it anywhere, but can\'t find it on google.

My questi

5条回答
  •  我在风中等你
    2020-12-05 02:50

    If you want to have a select list (which does not evolve) you can define a method in your ApplicationHelper that returns a list, for example:

     def my_color_list
       [
         "red",
         "green",
         "blue"
       ]
     end
    

提交回复
热议问题