Add specs for editor in nested resources

Этот коммит содержится в:
Mattia Roccoberton
2020-09-03 11:32:46 +02:00
родитель 668bd642e5
Коммит 135a56dc03
6 изменённых файлов: 53 добавлений и 4 удалений

Просмотреть файл

@@ -1,9 +1,12 @@
# frozen_string_literal: true
ActiveAdmin.register Author do
menu priority: 1
permit_params :name, :email, :age, :avatar, profile_attributes: %i[id description _destroy]
permit_params :name,
:email,
:age,
:avatar,
profile_attributes: %i[id description _destroy],
posts_attributes: %i[id title description]
index do
selectable_column
@@ -28,6 +31,7 @@ ActiveAdmin.register Author do
row :created_at
row :updated_at
row :profile
row :posts
end
active_admin_comments
end
@@ -44,6 +48,10 @@ ActiveAdmin.register Author do
f.has_many :profile, allow_destroy: true do |ff|
ff.input :description
end
f.has_many :posts do |fp|
fp.input :title
fp.input :description, as: :quill_editor
end
f.actions
end
end

Просмотреть файл

@@ -25,6 +25,14 @@ ActiveAdmin.register Post do
row :tags
row :created_at
row :updated_at
row :images do |resurce|
resurce.images.each do |image|
div do
link_to image.filename, image, target: '_blank'
end
end
nil
end
end
active_admin_comments
end