From 51f45c43c97564c96a80b382098267b96edb50a7 Mon Sep 17 00:00:00 2001 From: Alex Platteeuw Date: Mon, 17 Jul 2023 14:07:19 +0200 Subject: [PATCH 1/2] Add support for Active Admin 3.0 --- activeadmin-searchable_select.gemspec | 2 +- spec/support/models.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/activeadmin-searchable_select.gemspec b/activeadmin-searchable_select.gemspec index c3a3f61..66b28c4 100644 --- a/activeadmin-searchable_select.gemspec +++ b/activeadmin-searchable_select.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'semmy', '~> 1.0' spec.add_development_dependency 'sprockets', '~> 3.7' - spec.add_runtime_dependency 'activeadmin', ['>= 1.x', '< 3'] + spec.add_runtime_dependency 'activeadmin', ['>= 1.x', '< 4'] spec.add_runtime_dependency 'jquery-rails', ['>= 3.0', '< 5'] spec.add_runtime_dependency 'select2-rails', '~> 4.0' end diff --git a/spec/support/models.rb b/spec/support/models.rb index cd1414e..8bf5d8e 100644 --- a/spec/support/models.rb +++ b/spec/support/models.rb @@ -4,6 +4,10 @@ class User < ActiveRecord::Base; end class Category < ActiveRecord::Base belongs_to :created_by, class_name: 'User' + + def self.ransackable_attributes(_auth_object = nil) + ['name'] + end end class Post < ActiveRecord::Base @@ -11,6 +15,10 @@ class Post < ActiveRecord::Base belongs_to :user scope(:published, -> { where(published: true) }) + + def self.ransackable_attributes(_auth_object = nil) + %w(category_id title) + end end module RGB @@ -24,6 +32,10 @@ module Internal class TagName < ActiveRecord::Base self.table_name = :internal_tag_names belongs_to :color, class_name: 'RGB::Color', foreign_key: :color_id + + def self.ransackable_attributes(_auth_object = nil) + ['color_id'] + end end end @@ -31,6 +43,10 @@ class OptionType < ActiveRecord::Base; end class OptionValue < ActiveRecord::Base belongs_to :option_type + + def self.ransackable_attributes(_auth_object = nil) + ['value'] + end end class Product < ActiveRecord::Base From f8e4c4e932a0d9ff35380610c2181ade4bfdcc10 Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Thu, 17 Aug 2023 08:11:11 +0200 Subject: [PATCH 2/2] Run tests for ActiveAdmin 3 --- .github/workflows/tests.yml | 2 ++ Appraisals | 7 ++++++- gemfiles/rails_6.x_active_admin_3.x.gemfile | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gemfiles/rails_6.x_active_admin_3.x.gemfile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c5ea9a1..2b0fcad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,8 @@ jobs: include: - ruby-version: '3.0' gemfile: gemfiles/rails_6.x_active_admin_2.x.gemfile + - ruby-version: '3.0' + gemfile: gemfiles/rails_6.x_active_admin_3.x.gemfile env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} diff --git a/Appraisals b/Appraisals index 16ac6de..a4df4a4 100644 --- a/Appraisals +++ b/Appraisals @@ -16,4 +16,9 @@ end appraise 'rails-6.x-active-admin-2.x' do gem 'rails', '~> 6.1' gem 'activeadmin', '~> 2.0' -end \ No newline at end of file +end + +appraise 'rails-6.x-active-admin-3.x' do + gem 'rails', '~> 6.1' + gem 'activeadmin', '~> 3.0' +end diff --git a/gemfiles/rails_6.x_active_admin_3.x.gemfile b/gemfiles/rails_6.x_active_admin_3.x.gemfile new file mode 100644 index 0000000..b86b845 --- /dev/null +++ b/gemfiles/rails_6.x_active_admin_3.x.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "sass-rails" +gem "rails", "~> 6.1" +gem "activeadmin", "~> 3.0" + +gemspec path: "../"