Fixed ransack attributes

This commit is contained in:
Sergei Tsoganov 2023-04-06 14:15:05 +03:00
parent aa8d8c35e8
commit 33175eea88
19 changed files with 63 additions and 59 deletions

View file

@ -16,12 +16,12 @@ class Account < ApplicationRecord
[id, balance, currency, registrar]
end
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.csv_header

View file

@ -25,12 +25,12 @@ class AccountActivity < ApplicationRecord
end
class << self
def ransackable_attributes(auth_object = nil)
super
def ransackable_associations(*)
authorizable_ransackable_associations
end
def ransackable_associations(auth_object = nil)
super
def ransackable_attributes(*)
authorizable_ransackable_attributes
end
def types_for_select

View file

@ -5,12 +5,12 @@ module ApiLog
# for a configuration lookup is deprecated
establish_connection "api_log_#{Rails.env}".to_sym
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
end
end

View file

@ -33,12 +33,12 @@ class Auction < ApplicationRecord
where('domain ilike ?', "%#{domain_name.strip}%") if domain_name.present?
}
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.pending(domain_name)

View file

@ -10,8 +10,8 @@ class BankStatement < ApplicationRecord
PARTIALLY_BINDED = 'partially_binded'.freeze
NOT_BINDED = 'not_binded'.freeze
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
# TODO: Cache this to database so it can be used for searching

View file

@ -8,12 +8,12 @@ class BankTransaction < ApplicationRecord # rubocop:disable Metrics/ClassLength
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
}
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def binded?

View file

@ -21,8 +21,8 @@ module Billing
new_record? || duration_changed?
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.operation_categories

View file

@ -6,12 +6,12 @@ class BlockedDomain < ApplicationRecord
validates :name, domain_name: true, uniqueness: true
class << self
def ransackable_attributes(auth_object = nil)
super
def ransackable_associations(*)
authorizable_ransackable_associations
end
def ransackable_associations(auth_object = nil)
super
def ransackable_attributes(*)
authorizable_ransackable_attributes
end
def by_domain(name)

View file

@ -183,11 +183,11 @@ class Contact < ApplicationRecord
#
class << self
def ransackable_associations(auth_object = nil)
super
def ransackable_associations(*)
authorizable_ransackable_associations
end
def ransackable_attributes(auth_object = nil)
def ransackable_attributes(*)
authorizable_ransackable_attributes
end

View file

@ -21,12 +21,12 @@ class Dispute < ApplicationRecord # rubocop:disable Metrics/ClassLength
Domain.find_by(name: domain_name)
end
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.close_by_domain(domain_name)

View file

@ -245,11 +245,11 @@ class Domain < ApplicationRecord
end
class << self
def ransackable_associations(auth_object = nil)
def ransackable_associations(*)
authorizable_ransackable_associations
end
def ransackable_attributes(auth_object = nil)
def ransackable_attributes(*)
authorizable_ransackable_attributes
end

View file

@ -144,12 +144,12 @@ class Invoice < ApplicationRecord
]
end
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.csv_header

View file

@ -87,7 +87,7 @@ class Nameserver < ApplicationRecord
pluck(:hostname)
end
def ransackable_attributes(auth_object = nil)
def ransackable_attributes(*)
authorizable_ransackable_attributes
end
end

View file

@ -51,11 +51,11 @@ class Registrar < ApplicationRecord # rubocop:disable Metrics/ClassLength
self.ignored_columns = %w[legacy_id]
class << self
def ransackable_associations(auth_object = nil)
super
def ransackable_associations(*)
authorizable_ransackable_associations
end
def ransackable_attributes(auth_object = nil)
def ransackable_attributes(*)
authorizable_ransackable_attributes
end

View file

@ -13,12 +13,12 @@ class ReservedDomain < ApplicationRecord
self.ignored_columns = %w[legacy_id]
class << self
def ransackable_attributes(auth_object = nil)
super
def ransackable_associations(*)
authorizable_ransackable_associations
end
def ransackable_associations(auth_object = nil)
super
def ransackable_attributes(*)
authorizable_ransackable_attributes
end
def pw_for(domain_name)

View file

@ -17,12 +17,12 @@ class Version::ContactVersion < PaperTrail::Version
]
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.csv_header

View file

@ -18,12 +18,12 @@ class Version::DomainVersion < PaperTrail::Version
]
end
def self.ransackable_attributes(auth_object = nil)
super
def self.ransackable_associations(*)
authorizable_ransackable_associations
end
def self.ransackable_associations(auth_object = nil)
super
def self.ransackable_attributes(*)
authorizable_ransackable_attributes
end
def self.was_contact_linked?(contact_id)

View file

@ -5,7 +5,11 @@ class PartialSearchFormatter
search_params.each do |key, value|
next unless key.include?('matches') && value.present?
search_params[key] = value =~ /\A\*.*\*\z/ ? value.gsub(/\A\*|\*\z/, '') : "%#{value}%"
if value =~ /\A\*.*\*\z/
search_params[key] = value.gsub(/\A\*|\*\z/, '')
else
search_params[key] = "%#{value}%"
end
end
search_params

View file

@ -67,7 +67,7 @@
</div>
<div class="row">
<div class="col-md-5"></div>
<div class="col-md-5">Tip: Use format *text* for exact match!</div>
<div class="col-md-3"></div>
<div class="col-md-4">
<div class="form-group">