Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nb/working through ransack issues #169

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/codecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- run: bundle exec rubocop
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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: .
Expand Down
3 changes: 3 additions & 0 deletions lib/active_admin/mongoid/association/relatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions lib/active_admin/mongoid/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions test_app/app/models/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ class Post

embeds_one :author
field :'author.city.name'

def self.ransackable_scopes(auth_object = nil)
[:admin_user]
end

end
Loading