Module: Motor::ActiveRecordUtils::FetchMethods

Defined in:
lib/motor/active_record_utils/fetch_methods.rb

Constant Summary collapse

EXCLUDE_METHODS =
%i[
  password
  current_password
  password_confirmation
  devise_modules
].freeze

Class Method Summary collapse

Class Method Details

.call(model) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/motor/active_record_utils/fetch_methods.rb', line 15

def call(model)
  (model.instance_methods(false) - model.superclass.instance_methods).reject do |name|
    next true if EXCLUDE_METHODS.include?(name)
    next true if name.to_s.match?(/(:?=|\?|_id)\z/)
    next true if name.to_s.match?(/\A(?:validate|autosave)_associated_records/)
  end
end