Skip to content

Commit

Permalink
WIP: admin_user scope not being built
Browse files Browse the repository at this point in the history
  • Loading branch information
boie0025 committed Dec 4, 2023
1 parent 5866566 commit 7114d81
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
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

0 comments on commit 7114d81

Please sign in to comment.