Object appear problem in active admin form [Ruby on Rails]
If you use active admin and if you use migration with references, in admin panel you can see object number on edit or new form.
Let's say we have a company and a user table, and we have a reference to user_id in company.
I assume that "belongs_to" and "has_many" added.
You write in terminal "rails generate migration AddUserReferecesToCompanies user:references" and then enter commandline "rails db:migrate".
Now you add this line in app/admin/companies.rb (because we are the model we initially assumed. Also you must be generated activeadmin resource like "rails g active_admin:resource company".)
Let's say we have a company and a user table, and we have a reference to user_id in company.
I assume that "belongs_to" and "has_many" added.
You write in terminal "rails generate migration AddUserReferecesToCompanies user:references" and then enter commandline "rails db:migrate".
Now you add this line in app/admin/companies.rb (because we are the model we initially assumed. Also you must be generated activeadmin resource like "rails g active_admin:resource company".)
Yorumlar
Yorum Gönder