From 586656638f97585019be923b17f59623d0a99cff Mon Sep 17 00:00:00 2001 From: Nic Boie Date: Mon, 4 Dec 2023 14:21:57 -0600 Subject: [PATCH 1/5] Changes action to use sys libs for nokogiri --- .github/workflows/codecheck.yml | 4 +++- .github/workflows/tests.yml | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codecheck.yml b/.github/workflows/codecheck.yml index 74e9f03..2fb4e6c 100644 --- a/.github/workflows/codecheck.yml +++ b/.github/workflows/codecheck.yml @@ -12,7 +12,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 + env: + BUNDLE_NOKOGIRI___C: "--use-system-libraries" with: ruby-version: 2.7 bundler-cache: true - - run: bundle exec rubocop \ No newline at end of file + - run: bundle exec rubocop diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb6a602..8857eef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,6 +24,8 @@ jobs: steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 + env: + BUNDLE_NOKOGIRI___C: "--use-system-libraries" with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 7114d816e865f6cae6b40d2108c13670a1b65582 Mon Sep 17 00:00:00 2001 From: Nic Boie Date: Mon, 4 Dec 2023 15:10:07 -0600 Subject: [PATCH 2/5] WIP: admin_user scope not being built --- Gemfile | 2 +- Gemfile.lock | 7 ++++--- lib/active_admin/mongoid/association/relatable.rb | 3 +++ lib/active_admin/mongoid/document.rb | 8 ++++++++ test_app/app/models/post.rb | 5 +++++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 6de200c..a21daa0 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' gemspec -gem 'ransack-mongoid', git: 'https://github.com/activerecord-hackery/ransack-mongoid' +gem 'ransack-mongoid', git: 'https://github.com/jesusalc/ransack-mongoid', branch: 'rails-6-mongoid-7-ruby-2-7-0' gem 'rails', '>= 5.2', '< 6.1' diff --git a/Gemfile.lock b/Gemfile.lock index f85a85e..51da8ec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,9 @@ GIT - remote: https://github.com/activerecord-hackery/ransack-mongoid - revision: bd1935293d2f285fa7cf33d2c5c90d981bf67338 + remote: https://github.com/jesusalc/ransack-mongoid + revision: b7f68881081731afdfaa010499d06adc93d17d71 + branch: rails-6-mongoid-7-ruby-2-7-0 specs: - ransack-mongoid (0.1.0) + ransack-mongoid (0.1.1) PATH remote: . diff --git a/lib/active_admin/mongoid/association/relatable.rb b/lib/active_admin/mongoid/association/relatable.rb index 6f17a87..5868c43 100644 --- a/lib/active_admin/mongoid/association/relatable.rb +++ b/lib/active_admin/mongoid/association/relatable.rb @@ -11,4 +11,7 @@ def foreign_key return if embeds? foreign_key.to_sym rescue nil end + + alias_method :association_primary_key, :foreign_key + end diff --git a/lib/active_admin/mongoid/document.rb b/lib/active_admin/mongoid/document.rb index 8f89f92..5ab62c7 100644 --- a/lib/active_admin/mongoid/document.rb +++ b/lib/active_admin/mongoid/document.rb @@ -70,6 +70,14 @@ def associations def reflections *a relations *a end + + def ransackable_scopes_skip_sanitize_args + [] + end + + def self.ransackable_scopes(auth_object = nil) + [] + end end end diff --git a/test_app/app/models/post.rb b/test_app/app/models/post.rb index 57b9704..dfe669d 100644 --- a/test_app/app/models/post.rb +++ b/test_app/app/models/post.rb @@ -10,4 +10,9 @@ class Post embeds_one :author field :'author.city.name' + + def self.ransackable_scopes(auth_object = nil) + [:admin_user] + end + end From 1f20552f43bbffb22c0373960346e0e64d9f9434 Mon Sep 17 00:00:00 2001 From: JD Guzman Date: Tue, 5 Dec 2023 12:52:51 +0000 Subject: [PATCH 3/5] update bundle build env var --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8857eef..a59fed9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 env: - BUNDLE_NOKOGIRI___C: "--use-system-libraries" + BUNDLE_BUILD_NOKOGIRI___C: "--use-system-libraries" with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 0767159c269df7347d419619b779a234bc0d6a7b Mon Sep 17 00:00:00 2001 From: JD Guzman Date: Tue, 5 Dec 2023 13:08:26 +0000 Subject: [PATCH 4/5] missed some changes to env var --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a59fed9..dbadf44 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 env: - BUNDLE_BUILD_NOKOGIRI___C: "--use-system-libraries" + BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries" with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 68bde1c2622b9a9ff24572bd644bcfcb6b6f9781 Mon Sep 17 00:00:00 2001 From: JD Guzman Date: Tue, 5 Dec 2023 13:35:30 +0000 Subject: [PATCH 5/5] try with ruby 2.7.1 --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dbadf44..d4d18fa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - ruby: [2.5, 2.6, 2.7] + ruby: [2.5, 2.6, 2.7.1] runs-on: ${{ matrix.os }} services: @@ -24,8 +24,6 @@ jobs: steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 - env: - BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries" with: ruby-version: ${{ matrix.ruby }} bundler-cache: true