Skip to content

Commit

Permalink
Merge pull request #2037 from tf/ransack-auth-obj
Browse files Browse the repository at this point in the history
Do not require auth object for ransackable_* methods
  • Loading branch information
tf authored Dec 12, 2023
2 parents 108aecc + e51c824 commit 56d398d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/models/pageflow/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def blacklist_for_serialization
[:features_configuration]
end

def self.ransackable_attributes(_auth_object)
def self.ransackable_attributes(_auth_object = nil)
%w[id name]
end

def self.ransackable_associations(_auth_object)
def self.ransackable_associations(_auth_object = nil)
[]
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/models/pageflow/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ def default_permalink_slug
title.to_s.parameterize
end

def self.ransackable_attributes(_auth_object)
def self.ransackable_attributes(_auth_object = nil)
%w[title type_name created_at edited_at first_published_at]
end

def self.ransackable_associations(_auth_object)
def self.ransackable_associations(_auth_object = nil)
%w[account published_revision]
end

def self.ransackable_scopes(_)
def self.ransackable_scopes(_auth_object = nil)
[:with_publication_state, :published]
end

Expand Down
8 changes: 4 additions & 4 deletions app/models/pageflow/revision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ def configuration
.merge(read_attribute(:configuration) || {})
end

def self.ransackable_attributes(_auth_object = nil)
%w[published_at]
end

private

def files(model)
Expand Down Expand Up @@ -234,9 +238,5 @@ def published_at_blank?
def available_themes
@available_themes ||= Pageflow.config_for(entry).themes
end

def self.ransackable_attributes(_auth_object)
%w[published_at]
end
end
end
4 changes: 2 additions & 2 deletions app/models/pageflow/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def theme_name
first_paged_entry_template.theme_name
end

def self.ransackable_attributes(_auth_object)
def self.ransackable_attributes(_auth_object = nil)
%w[name]
end

def self.ransackable_associations(_auth_object)
def self.ransackable_associations(_auth_object = nil)
%w[account]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pageflow/user_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def send_devise_notification(notification, *args)
end

module ClassMethods
def ransackable_attributes(_auth_object)
def ransackable_attributes(_auth_object = nil)
%w[first_name last_name email]
end
end
Expand Down

0 comments on commit 56d398d

Please sign in to comment.