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] [id, balance, currency, registrar]
end end
def self.ransackable_associations(auth_object = nil) def self.ransackable_associations(*)
super authorizable_ransackable_associations
end end
def self.ransackable_attributes(auth_object = nil) def self.ransackable_attributes(*)
super authorizable_ransackable_attributes
end end
def self.csv_header def self.csv_header

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,11 @@ class PartialSearchFormatter
search_params.each do |key, value| search_params.each do |key, value|
next unless key.include?('matches') && value.present? 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 end
search_params search_params

View file

@ -67,7 +67,7 @@
</div> </div>
<div class="row"> <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-3"></div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">