I have a user model with 5 fruits:
User
fruit_1
fruit_2
fruit_3
fruit_4
fruit_5
Is it possible to do a for-each when inserting into the user model? Like
@fruits = ['apple','banana','orange','strawberry','blueberry']
user = User.new
@fruits.each do |a, fruit |
user.fruit_a = fruit <-- I want a to be the actual variable.
end