Skip to content

Commit

Permalink
fix: multiple word resources bad cache hash (#2598)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Mar 15, 2024
1 parent 789393d commit f838288
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/avo/base_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,14 @@ def authorization(user: nil)
def file_hash
content_to_be_hashed = ""

# resource file hash
resource_path = Rails.root.join("app", "avo", "resources", "#{self.class.name.underscore}.rb").to_s
file_name = self.class.underscore_name.tr(" ", "_")
resource_path = Rails.root.join("app", "avo", "resources", "#{file_name}.rb").to_s
if File.file? resource_path
content_to_be_hashed += File.read(resource_path)
end

# policy file hash
policy_path = Rails.root.join("app", "policies", "#{self.class.name.underscore.gsub("_resource", "")}_policy.rb").to_s
policy_path = Rails.root.join("app", "policies", "#{file_name.gsub("_resource", "")}_policy.rb").to_s
if File.file? policy_path
content_to_be_hashed += File.read(policy_path)
end
Expand Down

0 comments on commit f838288

Please sign in to comment.