I got a weird problem in activeadmin in rails project.
I have created new rails project and two tables as followings.
rails g model category title:text
rails g model subcategory category:references title:text
subcategory belongs to category with the foreign key "category_id" by reference keyword. I have changed the category and subcategory models as the following.
class Category < ActiveRecord::Base
has_many :subcategories, dependent: :destroy
end
and
class Subcategory < ActiveRecord::Base
belongs_to :category
default_scope -> { order(created_at: :desc) }
end
I added the activeadmin gem in the Gemfile and installed.
ActiveAdmin.register Category do
permit_params :title
end
ActiveAdmin.register Subcategory do
permit_params :category_id, :title
end
I logged in successfully.
I added new category. If I click the subcategory in order to create new subcagegory, category item brings errors like the image.

I want to show the categories added by me. Best Regards.