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

Override Alchemy::Page.ransackable_scopes #2328

Merged
merged 1 commit into from
May 4, 2022
Merged
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: 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