0

I'm using a tableless model to create a form. I want to set one of the model attributes as an array

I know the following code doesn't work, but just showing what I want to do:

Model:

class Quote
  include ActiveModel::Model
  include ActiveModel::Serialization

  attr_accessor :name, :length, :width, :city
  serialize :quantity, Array
end

Then reference in the form using:

f.text_field :quantity, multiple: true, class: 'form-control', type: 'number'
f.text_field :quantity, multiple: true, class: 'form-control', type: 'number'

How can I go about achieving this? Thank you.

massaskillz
  • 283
  • 3
  • 10

0 Answers0