I'm using rails 4.0.0 and I have a form that I'd like to limit to 3 added associations. What is the cleanest way to do this?

= nested_form_for(@donation) do |f|
  = render 'shared/error_messages', object: f.object

  = f.fields_for :donation_devices do |f2|
    %p
      = f2.collection_select(:device_model_id, DeviceModel.all, :id, :name)
      = f2.link_to_remove "Remove Device"
  = f.link_to_add "Add Device", :donation_devices
0

There are 0 answers