Skip to content

Commit

Permalink
Merge pull request #2328 from mamhoff/ransackable-scopes
Browse files Browse the repository at this point in the history
Override Alchemy::Page.ransackable_scopes
  • Loading branch information
tvdeyen committed May 6, 2022
1 parent 06bd61c commit 96a6b19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/alchemy/page/page_scopes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def not_public(time = Time.current)
)
SQL
end

def ransackable_scopes(_auth_object)
[:published, :from_current_site, :searchables, :layoutpages]
end
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions spec/models/alchemy/page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,14 @@ class AnotherUrlPathClass; end
expect(subject.collect { |e| e["name"] }).not_to include("unique_headline")
end
end

describe ".ransackable_scopes" do
let(:auth_object) { double }

subject { described_class.ransackable_scopes(auth_object) }

it { is_expected.to match_array([:published, :from_current_site, :layoutpages, :searchables]) }
end
end

describe "#available_elements_within_current_scope" do
Expand Down

0 comments on commit 96a6b19

Please sign in to comment.