ActiveAdmin creates parent objects in child form

I would like to be able to assign industry_id to a new business model when I create it. Create a new Industry instance that will be added to the new business model when you create a new business.

Here are my models

class Business < ActiveRecord::Base attr_accessible :name, :industry, :owner belongs_to :industry end class Industry < ActiveRecord::Base attr_accessible :name has_many businesses accepts_nested_attributes_for :businesses end 

I tried in every way to create a form that would allow this, but I was not lucky at all.

The Formtastic documentation is missing any examples of this, as well as ActiveAdmin.

+4
source share

Source: https://habr.com/ru/post/1495841/


All Articles